--- reg_with_pic.module	Wed May 05 23:49:22 2010
+++ reg_with_pic_fix.module	Sat May 08 00:08:31 2010
@@ -78,6 +78,15 @@ function reg_with_pic_user($op, &$edit, 
         $required = variable_get('reg_with_pic_required', 0);
         $errors = form_get_errors();
 
+        // dynamically set the field name based on input
+        if (isset($edit['picture_upload'])) {
+          $form_type = 'edit';
+          $pic_field = 'picture_upload';
+        } else {
+          $form_type = 'register';
+          $pic_field = 'picture_upload_register';
+        }
+
         // only attempt to validate photo if one is required, or if there are no other errors
         if ($required == 1 || count($errors) == 0) {
 
@@ -87,15 +96,6 @@ function reg_with_pic_user($op, &$edit, 
             'file_validate_image_resolution' => array(variable_get('user_picture_dimensions', '85x85')),
             'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
           );
-
-          // dynamically set the field name based on input
-          if (isset($edit['picture_upload'])) {
-            $form_type = 'edit';
-            $pic_field = 'picture_upload';
-          } else {
-            $form_type = 'register';
-            $pic_field = 'picture_upload_register';
-          }
 
           $file = file_save_upload($pic_field, $validators);
 
