I migrated my web to webhosting. There is a problem when I want to add new content, it's not able to add new content with images or files. Do you know where to look to solve it? Does it relate to access rights to directories where Drupal stores those files or is it something else?

When I want to upload an image, it writes:

  • Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to access public://image.jpg in file_save_upload() (line 1528 of /web/www/x.y.com/includes/file.inc).

  • File upload error. Could not move uploaded file.

thank you

closed as too localized by user842, tim.plunkett Aug 22 '11 at 14:22

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    review permissions in the /sites/all/files directory. also review the owner. – cigotete Aug 15 '11 at 19:01
  • I have the exact same problem. Can't believe this question is closed for being "too localized!" That's silly. – gMale Mar 24 '12 at 23:54
  • For me, the issue was PHP has SAFE_MODE set to ON. I cannot change this easily with my host. So following the instructions here worked. Basically, you modify line 1528 of includes/file.inc to the following: if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], drupal_realpath($file->uri))) { of course, the better solution is to turn off safe mode, if you can. – gMale Mar 25 '12 at 1:17

review permissions in the /sites/all/files directory. you can test inside files directory, changing permissions to test the correct permissions. for example you, for test, can change to 755 in recursive mode: chmod 755 files/ -R. also review the owner of directory. According my experience, the owner can be a cause.

(According I remember, permission 777 number is the most higher number, but not is recommended).

  • I prefer to use chown than chmod :-) – Sivaji Aug 15 '11 at 19:22
  • I don't have sites/all/files directory. It was working without it on localhost. – xralf Aug 16 '11 at 17:34
  • I changed the permissions of sites/default/files recursively to 755 but this didn't help. When I want to add image it writes something like unable to load file – xralf Aug 16 '11 at 17:42
  • I edited the question and set permissions to 777. – xralf Aug 16 '11 at 17:47
  • well, seems that could be related with the tmp directory drupal.org/node/84405#comment-872211. I suggest update the tmp path in your Drupal, and review the permissions of this new tmp directory. – cigotete Aug 16 '11 at 18:18

Please define "it's not able to add new content with images or files" ? was the content save failed or only the image failed to attach ? I suggest you check Drupal status report.

  • 3
    this should be a comment. it's not an answer. – user842 Aug 15 '11 at 19:36
  • @Sivaji The content save failed. – xralf Aug 16 '11 at 17:35
  • Checking Drupal status report will probably reveal the cause (and fix) most of the time. It is worth to be an answer, IMO. – Sivaji Aug 16 '11 at 18:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.