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

Abstract image of building floors that have different colors and are numbered

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.

Setup your Mac for Pentesting

Setup Your Mac For Pentesting

Get Your Mac Setup With Pen Test Tools

I’ve been using Kali for sometime now and while I do like Kali, running it from a VM can sometimes be a pain. So I started to wonder if there was a way to bypass running a VM for these security tools and instead use my host machine, my Mac.

  1. Overview
  2. How to install Pentest Tools
  3. Installing a Pentest Tool like Dirb



At first I was going to mimic Kali’s tools in folders on my Mac. Installing the tools I wanted manually, then I decided to stop and research if there was an easier way. Upon doing so I found this:

Homebrew Tap – Pen Test Tools
Essentially this is a collection of brew taps that will install the various tools you find in Kali. Score!

A prerequisite to use this Pen Test Tools is to have brew installed. Brew is a package manager for your Mac, it allows you to install Linux packages on your Mac, it’s really convenient.


How to install Pentest Tools

After you install brew you can run the following command:

$ brew tap sidaf/pentest

Installing Pen Test Tools
This will install the Pen Test Tools tap (aka. a repository), from there you can install one of the tools as seen below.


Installing a Pentest Tool like Dirb

$ brew install sidaf/pentest/dirb
Installing Dirb

Installing Dirb

Verifying Dirb is Installed

Verifying Dirb is Installed

This will install the Dirb tool (used to discover hidden files and directories).



Now that you can install and run some of Kali’s pentest tools you’ll be able to hunt for bugs without launch a VM. Good hunting 🙂

Feel free to let me know your how you have your mac setup to do pentesting and any additional tip/tricks you use.