How can I allow more file extensions with file uploads? I've got a module that let users upload files, and everything works as long as the files are in the standard array of allowed extensions. I've tried using file_validate_extensions(), but this doesn't seem to change anything.

This is the code I'm using to upload now (the docx extension is added to the standard allowed ones, but it doesn't seem to get picked up):

$fid = $form_state['values']['attachment'];
$file = file_load($fid);

if ($file != null) {
  file_validate_extensions($file, "jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp docx");
  $file-&gt;status = FILE_STATUS_PERMANENT;
  file_save($file);
}
You actually have to check for the return values of the file_validate_extensions() function in order to detect if any errors have occurred.

so your code would be something like this:

$fid = $form_state['values']['attachment'];
$file = file_load($fid);

if ($file != null) {
  $extension_errors=file_validate_extensions($file, "jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp docx");
  if (!$extension_errors) {
  $file-&gt;status = FILE_STATUS_PERMANENT;
  file_save($file);
  } else form_set_error('attachment',$extension_errors[0]);
}