--- drupal-6.17/modules/upload/upload.module	2010-05-19 10:43:56.000000000 -0400
+++ drupal-6.x-dev/modules/upload/upload.module	2010-06-22 00:44:03.000000000 -0400
@@ -164,10 +164,8 @@ function upload_file_download($filepath)
  * Save new uploads and store them in the session to be associated to the node
  * on upload_save.
  *
- * @param $node
- *   A node object to associate with uploaded files.
  */
-function upload_node_form_submit(&$form, &$form_state) {
+function upload_node_form_validate($form, &$form_state) {
   global $user;
 
   $limits = _upload_file_limits($user);
@@ -178,14 +176,30 @@ function upload_node_form_submit(&$form,
   );
 
   // Save new file uploads.
-  if (user_access('upload files') && ($file = file_save_upload('upload', $validators, file_directory_path()))) {
-    $file->list = variable_get('upload_list_default', 1);
-    $file->description = $file->filename;
-    $file->weight = 0;
-    $file->new = TRUE;
-    $form['#node']->files[$file->fid] = $file;
-    $form_state['values']['files'][$file->fid] = (array)$file;
+  if (user_access('upload files')) {
+    if (($file = file_save_upload('upload', $validators, file_directory_path()))) {
+      $file->list = variable_get('upload_list_default', 1);
+      $file->description = $file->filename;
+      $file->weight = 0;
+      $file->new = TRUE;
+      $form['#node']->files[$file->fid] = $file;
+      $form_state['values']['files'][$file->fid] = (array)$file;
+    } elseif (!empty($_FILES['files']['name']['upload'])) { 
+      form_set_error('upload');
+    }
   }
+}
+
+
+/**
+ * Save new uploads and store them in the session to be associated to the node
+ * on upload_save.
+ *
+ * @param $node
+ *   A node object to associate with uploaded files.
+ */
+function upload_node_form_submit(&$form, &$form_state) {
+  global $user;
 
   if (isset($form_state['values']['files'])) {
     foreach ($form_state['values']['files'] as $fid => $file) {
@@ -259,6 +273,7 @@ function upload_form_alter(&$form, $form
         $form['attachments']['wrapper'] += _upload_form($node);
         $form['#attributes']['enctype'] = 'multipart/form-data';
       }
+      $form['#validate'][] = 'upload_node_form_validate';
       $form['#submit'][] = 'upload_node_form_submit';
     }
   }
@@ -580,6 +595,7 @@ function upload_js() {
   $form_state = array('values' => $_POST);
 
   // Handle new uploads, and merge tmp files into node-files.
+  upload_node_form_validate($cached_form, $form_state);
   upload_node_form_submit($cached_form, $form_state);
 
   if(!empty($form_state['values']['files'])) {
