? validate.patch
Index: filefield.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield.module,v
retrieving revision 1.159
diff -u -p -r1.159 filefield.module
--- filefield.module	3 Dec 2008 23:22:11 -0000	1.159
+++ filefield.module	3 Dec 2008 23:23:14 -0000
@@ -318,9 +318,10 @@ function filefield_widget_upload_validat
   }
 
   $validators = array(
+    'filefield_validate_associate_field' => array($field['field_name']),
     'filefield_validate_size' => array($max_filesize),
-    // override core since it excludes uid 1 on the extension check.. I only want to
-    // excuse uid 1 of quota requirements. - dopry.
+    // Override core since it excludes uid 1 on the extension check. I only
+    // want to excuse uid 1 of quota requirements. - dopry.
     'filefield_validate_extensions' => array($field['widget']['file_extensions']),
   );
   return $validators;
@@ -683,7 +684,20 @@ function filefield_validate_is_image(&$f
   return $errors;
 }
 
-
 function filefield_validate_is_image_help($arguments = null) {
   return t('Must be a JPEG, PNG or GIF image');
 }
+
+/**
+ * A bit of a hack of a validator that adds the field name into the file.
+ *
+ * With out this validator modules implementing our file hooks won't know which
+ * file belong to which fields.
+ *
+ * @param $file Drupal file object.
+ * @param $field_name A CCK field name
+ */
+function filefield_validate_associate_field(&$file, $field_name) {
+  $file->field_name = $field_name;
+  return array();
+}
Index: filefield_widget.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/filefield/filefield_widget.inc,v
retrieving revision 1.44
diff -u -p -r1.44 filefield_widget.inc
--- filefield_widget.inc	16 Nov 2008 08:25:13 -0000	1.44
+++ filefield_widget.inc	3 Dec 2008 23:23:14 -0000
@@ -229,11 +229,11 @@ function filefield_widget_process($eleme
     );
   }
 
-
-
   foreach ($element['#upload_validators'] as $callback => $arguments) {
     $help_func = $callback .'_help';
-    $desc[] = call_user_func_array($help_func, $arguments);
+    if (function_exists($help_func)) {
+      $desc[] = call_user_func_array($help_func, $arguments);
+    }
   }
   $element['upload'] = array(
     '#name' => 'files['. $element['#field_name'] .'_'. $element['#delta'] .']',
