Recently, we published an article on how to fix common image issues in WordPress. Not too long after, one of our users asked us for help on a weird image upload issue she was facing. Basically she could not upload any image in WordPress, and if the upload goes through it will show images in the media library as broken. In this article, we will show you how to fix image upload issue in WordPress.
This issue is most commonly caused by wrong file permissions. Your uploads directory should have correct file permissions otherwise WordPress will not be able to store your files in it or sometimes may not even display files from the upload directory. To set correct file permissions for your uploads directory, you would need a FTP client, like Filezilla.
My site was working fine before? Who changed the File Permissions?
This can happen due to a number of reasons. Its possible that your web hostingprovider ran an upgrade and something caused the file permissions to change. It is also possible that a hacker made those changes while uploading a backdoor hack. On poorly configured share hosting, it is also possible that when one user installs a theme or plugin from an unreliable source, the script ends up mistakenly changing file permissions for everyone.
If everything is working fine on your website, then you just need to change file permissions back to normal. When in doubt, just ask your hosting provider for support.
Connect to your website using the FTP client and then go to
/wp-content/directory. There you will see
/uploads/ folder. Right click on the uploads directory and select file permissions.
A new dialog box for file permissions will open. At first you will need to set file permissions for uploads directory itself and all the sub directories inside it to 744. To do that, enter 744 in the numberic value box, and then check the box next to Recurse into subdirectories. Lastly, you need to click on ‘Apply to directories only’ radio button. Click on the OK button to apply these changes. Filezilla will now start applying file permissions to the directories.
Note: If setting directory permissions to 744 does not seem to solve your problem, then try 755.
In the next step, you will need to set file permissions for all the files in the uploads directory. To do that, right click on uploads directory and select file permissions. In the file permissions dialog box change the numeric value to 644. Check the box next to Recurse into subdirectories. Lastly, you need to click on Apply to files only radio button. Click on the OK button to apply these changes.
Filezilla will will now set the file permissions for all the files. Once it is done, you can go back to your WordPress admin area and try uploading images again.