WordPress Uploading Errors

By January 3, 2014 April 30th, 2014 Wordpress

For the first time in quite a while, I had installed WordPress onto a server on my own instead of using a scripting application such as SimpleScript.

One of the major issues I was facing was uploading and installing a new template. When I tried to upload the template onto the server, I was getting the following error:

The uploaded file could not be moved to wp-content/uploads/2014/01.

After a bit of research (Google), the majority of the solutions had basically told me to change the uploads folder and subfolder permissions to 777. Now this is obviously not safe at all – I needed a way to be able to upload content onto my site without the fear of anyone having access to it as well.

The solution? It seems that all that was needed was to change the owner of the folders to the correct user. So in order to find the correct user and change the owner, do the following steps.

To find the user, we’ll need the server to create a file for us that wasn’t uploaded by us initially.

  • Go to Settings > Permalinks
  • Select one of the options under Common Settings
  • Click Save

Now FTP (I’m using FileZilla) into your websites directory, and you will notice a file called .htaccess


Take note of the user and the user group this file has in the Owner/Group column in the far right.

Now that we know which user and user group the files need to be under, all we need to do is run a simple script using SSH. In my case, the user was “www-data” and the user group was also “www-data”, so the script will be as such:

  • sudo chown -R www-data:www-data /path/to/directory