This the contents of the red box, which I get when trying to update my user picture on groups.drupal.org:

* The selected file /tmp/tmp_Ghk3EK could not be copied.
* Failed to upload the picture image; the pictures directory doesn't exist.

(And it keeps my previous user picture luckily).

Comments

Gábor Hojtsy’s picture

Title: Groups.drupal.org file handling error » Unable to replace user picture on groups.drupal.org due to file setup errors

Maybe a more specific title will get some attention!

moshe weitzman’s picture

I routinely get reports of this. I really don't know what to say. I am hoping that Gerhard can look into it because Drupal's status report says that the temp and files directories are OK.

Gábor Hojtsy’s picture

Well, this is the validation part which results in the second error message:

if ($file = file_save_upload('picture_upload', variable_get('user_picture_path', 'pictures') .'/picture-'. $user->uid .'.'. $info['extension'], 1)) {
      $form_values['picture'] = $file->filepath;
    }
    else {
      form_set_error('picture_upload', t("Failed to upload the picture image; the %directory directory doesn't exist.", array('%directory' => variable_get('user_picture_path', 'pictures'))));
    }

The error message is misleading here (a Drupal bugfix is probably in order :), the directory could very well exist, but the file cannot be moved for some reason (as the first error message shows). It could happen that file or directory permissions are the reasons here (in the pictures directory).

killes@www.drop.org’s picture

Status: Active » Fixed

sudo chown -R apache:apache pictures
worked wonders...

Gábor Hojtsy’s picture

I also comitted a wording fix to the error message to indicate that it might be because of permission problems.

cvs diff: Diffing .
Index: user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.771
diff -u -p -r1.771 user.module
--- user.module 13 Apr 2007 08:56:59 -0000      1.771
+++ user.module 21 Apr 2007 20:44:42 -0000
@@ -331,7 +331,7 @@ function user_validate_picture($file, &$
       $form_values['picture'] = $file->filepath;
     }
     else {
-      form_set_error('picture_upload', t("Failed to upload the picture image; the %directory directory doesn't exist.", array('%directory' => variable_get('user_picture_path', 'pictures'))));
+      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'))));
     }
   }
 }
drumm’s picture

Committed to 5.

Goba- please attach patches.

drumm’s picture

er, Gábor.

Electrocat’s picture

Title: Unable to replace user picture on groups.drupal.org due to file setup errors » Failed to upload the picture image (Mass error for so many people)
Status: Fixed » Postponed (maintainer needs more info)

Nice that you guys have discussed this. I have now seen so many threads on this that I might have a problem uploading a picture file to my head.

Okay, so the directory doesn't exist. For this new install I am working with, that is totally correct.

The Image directory didn't exist either, but going to the config for the image module it made a check and WHAM! "Directory diesn't exist... Created directory..."

What I can't find is the page to visit in Drupal admin to see that the pictures directory should exist and then if not create the directory, make the correct permissions, ect...

Perhaps there should be a module that can parse all the directories that should exist, and make the necessary corrections.

The pictures directory is OWNED by drupal, so therefore we should be able to find a place to fix this in the admin settings.

As for this being changed to fixed? I don't see how anyone could call this fixed when a new install with a downloaded core pack from last week gets this problem.

Up an at 'em boys and girls, this is not fixed.

killes@www.drop.org’s picture

Status: Postponed (maintainer needs more info) » Fixed

this is fixed for groups.drupal.org

please don't hijack old issues.

Anonymous’s picture

Status: Fixed » Closed (fixed)
prokopton’s picture

Here's what worked for me on Ubuntu 10.04 LTS and PHP 5.2.x:

chown -R www-data:www-data /var/www/files/pictures/

chmod 775 /var/www/files/pictures/

You might want to use 777 if 775 doesn't work.

Component: Webserver » Servers