--- /cvs/drupal/drupal/includes/file.inc	2009/01/10 06:09:54	1.152
+++ /cvs/drupal/drupal/includes/file.inc	2009/01/21 02:07:10	1.154
@@ -1,5 +1,5 @@
 <?php
-// $Id: file.inc,v 1.151 2009/01/06 12:00:40 dries Exp $
+// $Id: file.inc,v 1.153 2009/01/20 02:56:04 webchick Exp $
 
 /**
  * @file
@@ -845,8 +845,8 @@
  *   destination directory should overwritten. A false value will generate a
  *   new, unique filename in the destination directory.
  * @return
- *   An object containing the file information, or FALSE in the event of an
- *   error.
+ *   An object containing the file information if the upload succeeded, FALSE
+ *   in the event of an error, or NULL if no file was uploaded.
  */
 function file_save_upload($source, $validators = array(), $destination = FALSE, $replace = FILE_EXISTS_RENAME) {
   global $user;
@@ -859,8 +859,8 @@
   }
 
   // Make sure there's an upload to process.
-  if (!isset($_FILES['files']['name'][$source])) {
-    return FALSE;
+  if (empty($_FILES['files']['name'][$source])) {
+    return NULL;
   }
 
   // Check for file upload errors and return FALSE if a lower level system
@@ -869,12 +869,12 @@
   switch ($_FILES['files']['error'][$source]) {
     case UPLOAD_ERR_INI_SIZE:
     case UPLOAD_ERR_FORM_SIZE:
-      drupal_set_message(t('The file %file could not be saved, because it exceeds %maxsize, the maximum allowed size for uploads.', array('%file' => $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'][$source], '%maxsize' => format_size(file_upload_max_size()))), 'error');
       return FALSE;
 
     case UPLOAD_ERR_PARTIAL:
     case UPLOAD_ERR_NO_FILE:
-      drupal_set_message(t('The file %file could not be saved, because the upload did not complete.', array('%file' => $source)), 'error');
+      drupal_set_message(t('The file %file could not be saved, because the upload did not complete.', array('%file' => $_FILES['files']['name'][$source])), 'error');
       return FALSE;
 
     case UPLOAD_ERR_OK:
@@ -886,7 +886,7 @@
 
     // Unknown error
     default:
-      drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $source)), 'error');
+      drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $_FILES['files']['name'][$source])), 'error');
       return FALSE;
   }
 
