Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The uploaded file could not be moved to wp-content/uploads/2015/01. issue on image upload

Tags:

php

wordpress

I am working on a WordPress website from 2 months and I have uploaded many images before but I am getting an error when uploading image and I am facing this issue after new year :- The uploaded file could not be moved to wp-content/uploads/2015/01.

there is Screenshot below:- The uploaded file could not be moved WordPress

like image 638
Kesar Sisodiya Avatar asked Jan 08 '15 16:01

Kesar Sisodiya


People also ask

How do you fix the uploaded file could not be moved to wp-content uploads?

Try changing the permissions on the wp-content directory to 766. If you still have problems, try 767, 775 or 777. Once your uploads are working, change the permissions on wp-content back to 755 again and check that everything still works OK.

Has failed to upload the uploaded file could not be moved to wp-content uploads?

'The uploaded file could not be moved to wp-content/uploads/' 'Unable to create directory wp-content/uploads/~. Is its parent directory writable by the server? ' To fix this error, you'll need terminal access to the server where your WordPress site is installed.

Why won't my photos upload on WordPress?

The image upload issue in WordPress is typically caused by incorrect file permissions. Your WordPress files are stored on your web hosting server and need specific file and directory permissions to work. Wrong file permissions prevent WordPress from reading or uploading file on the hosting server.


4 Answers

This article explains and resolves the issue very well: http://2surge.com/how-to-fix-the-uploaded-file-could-not-be-moved-to-wp-content-error-message

The basic premise is that the identity of the process running your httpd / apache / web server thread must have write access to your upload directory.

To resolve the issue:

  1. Check which account your webserver is running under

    Update: On Unix use...

    ps aux | egrep '(apache|httpd)'

    ... this will show a list of processes for the web server along with the identity of the process under which its running e.g."nobody"

    nobody 8718 0.1 0.4 1332864 17180 ? Sl 17:11 0:06 /usr/local/apache/bin/httpd -k start -DSSL

  2. Update the permission of the upload directory to allow that account to write to it.

    Update: On Unix, you can use...

    chown -R nobody /<path to upload directory>/wp-content/upload/

    You can also amend permissions for this account (at the rquired location) to ensure it has write permissions using chmod or filezilla and cascade the changes to the directories as necessary.

Check out the linked article for a detailed breakdown. Hope that helps! :)

like image 145
Matt Woodward Avatar answered Oct 17 '22 01:10

Matt Woodward


This works for me.

$ sudo chown -R _www uploads/
$ sudo chmod -R g+w uploads/

I am assuming you are in the wp-content directory.

like image 14
Jhelaine De Leon Avatar answered Oct 17 '22 00:10

Jhelaine De Leon


You just need to give permission to PHP to write in the uploads folder, this worked for me:

sudo chown -R www-data <path>/wp-content/uploads
like image 11
Commercial Suicide Avatar answered Oct 17 '22 01:10

Commercial Suicide


I have searched and found that the problem is from server provider.

Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared hosts, files should never be owned by the webserver process itself (sometimes this is www, or apache, or nobody user).

Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress (which may be different than the server account). For example, you may have a user account that lets you FTP files back and forth to your server, but your server itself may run using a separate user, in a separate usergroup, such as dhapache or nobody. If WordPress is running as the FTP account, that account needs to have write access, i.e., be the owner of the files, or belong to a group that has write access. In the latter case, that would mean permissions are set more permissively than default (for example, 775 rather than 755 for folders, and 664 instead of 644).

You can see here how to change file permission..

like image 6
Kesar Sisodiya Avatar answered Oct 16 '22 23:10

Kesar Sisodiya