drupal_set_message(t('The file %file could not be saved, because it exceeds %maxsize, the maximum allowed size for uploads.',array('%file'=>$_FILES['files']['name'][$source],'%maxsize'=>format_size(file_upload_max_size()))),'error');
drupal_set_message(t('The file %file could not be saved, because it exceeds %maxsize, the maximum allowed size for uploads.',array('%file'=>$_FILES['files']['name'][$form_field_name],'%maxsize'=>format_size(file_upload_max_size()))),'error');
returnFALSE;
caseUPLOAD_ERR_PARTIAL:
caseUPLOAD_ERR_NO_FILE:
drupal_set_message(t('The file %file could not be saved, because the upload did not complete.',array('%file'=>$_FILES['files']['name'][$source])),'error');
drupal_set_message(t('The file %file could not be saved, because the upload did not complete.',array('%file'=>$_FILES['files']['name'][$form_field_name])),'error');
returnFALSE;
caseUPLOAD_ERR_OK:
// Final check that this is a valid upload, if it isn't, use the
drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.',array('%file'=>$_FILES['files']['name'][$source])),'error');
drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.',array('%file'=>$_FILES['files']['name'][$form_field_name])),'error');
// If file_destination() returns FALSE then $replace == FILE_EXISTS_ERROR and
// there's an existing file so we need to bail.
if($file->destination===FALSE){
drupal_set_message(t('The file %source could not be uploaded because a file by that name already exists in the destination %directory.',array('%source'=>$source,'%directory'=>$destination)),'error');
drupal_set_message(t('The file %source could not be uploaded because a file by that name already exists in the destination %directory.',array('%source'=>$form_field_name,'%directory'=>$destination)),'error');
form_set_error($form_field_name,t('File upload error. Could not move uploaded file.'));
watchdog('file','Upload error. Could not move uploaded file %file to destination %destination.',array('%file'=>$file->filename,'%destination'=>$file->uri));