From e7ac5c58fd101d0de71a1397dd5b33f1b62c5fc7 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Mon, 15 Sep 2008 09:28:50 +0000 Subject: #308434 by drewish, dopry, quicksketch, aaron, jhedstrom, and friends: Massive file.inc cleanup aaaaaand... tests! Yay! :D --- modules/user/user.module | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/user/user.module') diff --git a/modules/user/user.module b/modules/user/user.module index 40c5d9588..50cd6695d 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -414,9 +414,9 @@ function user_validate_picture(&$form, &$form_state) { // files table as a temporary file. We'll make a copy and let the garbage // collector delete the original upload. $info = image_get_info($file->filepath); - $destination = variable_get('user_picture_path', 'pictures') . '/picture-' . $form['#uid'] . '.' . $info['extension']; - if (file_copy($file, $destination, FILE_EXISTS_REPLACE)) { - $form_state['values']['picture'] = $file->filepath; + $destination = file_create_path(variable_get('user_picture_path', 'pictures') . '/picture-' . $form['#uid'] . '.' . $info['extension']); + if ($filepath = file_copy($file->filepath, $destination, FILE_EXISTS_REPLACE)) { + $form_state['values']['picture'] = $filepath; } else { form_set_error('picture_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')))); -- cgit v1.2.3