Skip to content
Snippets Groups Projects
Commit 374a4527 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#172993 by drewish, Lynn: remove old user picture even when the newly uploaded...

#172993 by drewish, Lynn: remove old user picture even when the newly uploaded one uses a different format
parent 12957adb
No related merge requests found
......@@ -391,6 +391,11 @@ function user_validate_picture(&$form, &$form_state) {
'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
);
if ($file = file_save_upload('picture_upload', $validators)) {
// Remove the old picture.
if (isset($form_state['values']['_account']->picture) && file_exists($form_state['values']['_account']->picture)) {
file_delete($form_state['values']['_account']->picture);
}
// The image was saved using file_save_upload() and was added to the
// files table as a temporary file. We'll make a copy and let the garbage
// collector delete the original upload.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment