function upload_default_avatar_validate in Upload default avatar (user picture) 7
If image valid upload it to temp dir
Copied from user_validate_picture
_state
Parameters
$form:
1 string reference to 'upload_default_avatar_validate'
File
Code
function upload_default_avatar_validate(&$form, &$form_state) {
// If required, validate the uploaded picture.
$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,
),
);
// Save the file as a temporary file.
$file = file_save_upload('user_picture_default_upload', $validators);
if ($file === FALSE) {
form_set_error('user_picture_default_upload', t("Failed to upload the picture image; the %directory directory doesn't exist or is not writable.", array(
'%directory' => variable_get('user_picture_path', 'pictures'),
)));
}
elseif ($file !== NULL) {
$form_state['values']['user_picture_default_upload'] = $file;
}
}