### Eclipse Workspace Patch 1.0
#P Drupal HEAD (Core)
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.137
diff -u -r1.137 upload.module
--- modules/upload/upload.module	21 Nov 2006 20:14:19 -0000	1.137
+++ modules/upload/upload.module	23 Nov 2006 22:24:29 -0000
@@ -377,8 +377,22 @@
         '#prefix' => '<div id="attach-wrapper">',
         '#suffix' => '</div>',
       );
-      $form['attachments']['wrapper'] += _upload_form($node);
-      $form['#attributes']['enctype'] = 'multipart/form-data';
+
+      // Make sure necessary directories for upload.module exist and are 
+      // writable before displaying the attachment form.
+      if (!file_check_directory(file_directory_path(), FILE_CREATE_DIRECTORY) || !file_check_directory(file_directory_temp(), FILE_CREATE_DIRECTORY)) { 
+        $form['attachments']['#description'] =  t('File attachments are disabled. The file directories have not been properly configured.');
+        if (user_access('administer site configuration')) {
+          $form['attachments']['#description'] .= ' '. t('Please visit the <a href="@admin-file-system">file system configuration page</a>.', array('@admin-file-system' => url('admin/settings/file-system')));
+        }
+        else {
+          $form['attachments']['#description'] .= ' '. t('Please contact the site administrator.');
+        }
+      }
+      else {
+        $form['attachments']['wrapper'] += _upload_form($node);
+        $form['#attributes']['enctype'] = 'multipart/form-data';
+      }
     }
   }
 }
