at second submit, the upload file disapear, and the user register without picture
skipyT - October 3, 2008 - 10:48
| Project: | Register with Picture |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | skipyT |
| Status: | active |
Description
I have put on user register form some profile fields. And if the user gets an error message from validation, the user picture disapears, and the user is registered without picture!
I fixed the problem.
In the module script you must change the 'validate' case to handle if not exist picture:
case 'validate':
// validate uploaded picture, taken from user module
$validators = array(
'file_validate_is_image' => array(),
'file_validate_image_resolution' => array(variable_get('user_picture_dimensions', '85x85')),
'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
);
$file = file_save_upload('picture_upload_register', $validators);
if (!$file){form_set_error('reg_with_pic','No picture!!!');}
break;