When i upload a file, be it a avatar picture or image, the file loads however does not display.

I have checked the permissions on my hosting environment and it seems that everye uploaded file gets a 664 permission and apache as owner.

How can i give the uploaded files the proper permission automatically?

2 Answers 2


To fix the files permission, your folders and files needs to be readable and writable by Apache user.

Example commands to fix your permissions (assuming www-data is your Apache user, prefix with sudo if required):

chgrp -vR www-data "$(drush dd %files)" "$(drush dd %private)"
chmod -vR ug+rwX "$(drush dd %files)" "$(drush dd %private)"

You need to have drush command available. If you don't have drush, just replace above sub-commands in double-quotes with proper locations to your %files and %private folders.

Then as Drupal admin go to Reports -> Status Report and check for file-system related warnings.


664 should be sufficient to view the image.

However Drupal's image module creates different versions of uploaded images.

It needs to be able to write them into the files directory and create new directories, so your files directory (or at least the 'styles' directory within it) wants 755 permissions recursively (chmod -R 755 sites/default/files/styles)

  • After each attempt to upload an image i get two errors in my recent logs: 1.The file permissions could not be set on public://styles/thumbnail/public/pictures. 2.Failed to create style directory: public://styles/thumbnail/public/pictures However the /pictures folder has a 775 permission..
    – Byron
    Jan 27, 2015 at 10:00
  • including the subfolders
    – Byron
    Jan 27, 2015 at 10:11
  • I am running into the very same issue on drupal 8.x @Byron. Did you finally solve your problem ? Sep 7, 2018 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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