2018 Drupal tip: How to fix “The file could not be uploaded” file and folder permissions

Featured, How-to/Tutorial

How to fix the Drupal “The file could not be uploaded” error.


I can’t tell you how often I find myself googling or revisiting a ‘unknown‘ issue just for it to turn out to be a known unknown issue.

In this particular case it has to do with Drupal’s file upload. This ‘issue’ affects Drupal 7.57 and I imagine all versions, mainly because it’s not an issue with Drupal but more to do with configuration and setup.

Here’s how to resolve it:

The Problem

Folder permissions, specially the field and field/images folder which can be found at this path sites/default/files/field/image

The Answer

Change the Read-Write Access

If you can ssh into your server and goto sites/default/files then type the following command into your terminal:

$ chmod 777 field

$ chmod 777 field/image

You can try testing upload again, if this resolves the issue. If not you’ll have to change the ownership of the folders also.

Change the Owner and Group

First type:

$ ls -l

This will print out something that looks like this: drwxrwxrwx 2 "owner name" "group name" 4096 Mar 5 15:06 image

what you need to change is: “owner name” “group name” – minus the quotes obviously.

Now that we know what the owner name and group name for the folder we’re trying to change is, we do that same for another file in the files folder i.e. a folder like css.

Once you’ve done that type the following:

$ chown "new owner name:new group name" field

$ chown "new owner name:new group name" field/image

Again, don’t add the quotes or the any of the spaces.

Now this should resolve the issue, so try uploading again.

Last modified: March 7, 2018

Leave a Reply

Your email address will not be published. Required fields are marked *