Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.349
diff -u -r1.349 form.inc
--- includes/form.inc	7 Jul 2009 22:32:17 -0000	1.349
+++ includes/form.inc	12 Jul 2009 07:28:35 -0000
@@ -751,7 +751,11 @@
       // checkboxes, can return a valid value of '0'. Instead, check the
       // length if it's a string, and the item count if it's an array.
       if ($elements['#required'] && (!count($elements['#value']) || (is_string($elements['#value']) && strlen(trim($elements['#value'])) == 0))) {
-        form_error($elements, $t('!name field is required.', array('!name' => $elements['#title'])));
+        // One more specialized check for file type uploads, which store their
+        // value in the $_FILES array.
+        if ($elements['#type'] !== 'file' || !isset($_FILES['files']['name'][$elements['#name']])) {
+          form_error($elements, t('!name field is required.', array('!name' => $elements['#title'])));
+         }
       }
 
       // Verify that the value is not longer than #maxlength.
