Index: imagefield.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/imagefield.module,v
retrieving revision 1.30.2.6.2.75
diff -u -r1.30.2.6.2.75 imagefield.module
--- imagefield.module	15 Mar 2009 08:47:50 -0000	1.30.2.6.2.75
+++ imagefield.module	25 Jul 2009 00:19:26 -0000
@@ -231,22 +231,22 @@
     $widget_image_path = $field['widget']['image_path'];
   }
 
-  $filepath = file_create_path($widget_image_path) .'/'. $file['filename'];
-
-  if (imagefield_check_directory($widget_image_path) && $file = file_save_upload((object)$file, $filepath)) {
-    $file = (array)$file;
-    $file['fid'] = db_next_id('{files}_fid');
-    db_query("INSERT into {files} (fid, nid, filename, filepath, filemime, filesize)
-             VALUES (%d, %d, '%s','%s','%s',%d)",
-            $file['fid'], $node->nid, $file['filename'], $file['filepath'], $file['filemime'], $file['filesize']);
-    module_invoke_all('imagefield_file', 'save', $file);
-    return (array)$file;
-  }
-  else {
-    // Include file name in upload error.
-    form_set_error(null, t('Image upload was unsuccessful.'));
-    return false;
-  }
+  if (imagefield_check_directory($widget_image_path)){ 
+    $filepath = file_create_path($widget_image_path) .'/'. $file['filename'];
+    if ($file = file_save_upload((object) $file, $filepath)) {
+      $file = (array) $file;
+      $file['fid'] = db_next_id('{files}_fid');
+      db_query("INSERT into {files} (fid, nid, filename, filepath, filemime, filesize)
+               VALUES (%d, %d, '%s','%s','%s',%d)",
+              $file['fid'], $node->nid, $file['filename'], $file['filepath'], $file['filemime'], $file['filesize']);
+      module_invoke_all('imagefield_file', 'save', $file);
+      return (array) $file;
+    }
+  }
+  // Either directory creation or the upload failed.
+  // Include file name in upload error.
+  form_set_error(null, t('Image upload was unsuccessful.'));
+  return FALSE;
 }
 
 /**
