How to Fix WordPress Image Upload Problems
Table of Contents
This article explains how to resolve the most common problems related to uploading images on WordPress websites.
Unable to create directory. Is its parent directory writable by the server?
The problem is usually caused by incorrect permissions of the WordPress core folders, thus preventing the application from creating and managing the directories to store your uploads.
To fix this, you should reset the permissions of the WordPress files and folders to the default ones. This can be done from Site Tools > WordPress > Install & Manage > Manage Installations > Actions menu > Reset Permissions > Confirm.
Could not insert attachment into the database
When you see this error, usually you also cannot add new posts and pages to your website. This could be caused by an incorrectly configured auto increment value for the _posts table of your WordPress.
To fix this, access your website’s database from Site Tools -> Site -> MySQL -> PHPMyAdmin. From the left section find and click on the entry for the website’s database, then from the right section on the page find the _posts table, click on it and click the Operations tab at the top. In the Table options section set to 9999 and click Go to apply the change.
File exceeds the maximum upload size for this site
You may get this message when you try to upload an image larger than the allowed maximum upload size, which by default is 256M. It is not recommended to use very large images on your website, since they would take a long time to load fully and thus affect both the user experience and your website’s SEO ranking.
If you have to use such large files, you can get around this limitation by uploading the image via FTP or from Site Tools > File Manager to your website. It is recommended to upload the file in the wp-content/uploads/year/month/ folder, where ‘year’ is the current year and ‘month’ is the current month. If the folder does not exist – create it and then upload the images inside it.
Follow the instructions in the next section for the images to appear in your WordPress Media Library after you upload them.
“Sorry, This File Type Is Not Permitted for Security Reasons” Error
WordPress has a built-in limitation to the types of files that you can upload to your site for security reasons. If you try to upload a file with an extension outside of this predefined list you will see the above message.
To bypass limitation add the following line in your website’s wp-config.php file above the line ‘That’s all, stop editing! Happy publishing.’:
define('ALLOW_UNFILTERED_UPLOADS', true);
You can edit the file from your Site Tools > Site > File Manager.
Images not showing in Media Library after uploading via FTP/File Manager
WordPress by default does not automatically detect if you upload any new media in its folders. This is why after uploading an image manually via FTP or File Manager, you should add it to the media register of WordPress.
To do this, it is recommended you use a plugin named Add From Server. Install the plugin on your WordPress website and activate it. After that, go to Media > Add From Server and navigate to the location where you uploaded the images. Use the checkbox to the left of the list of images to select the ones that you want to add to the WordPress Media Library and click Import. The plugin will register the images for you and they should now appear in the Media Library.
Image previews not showing in WordPress Media Library
This problem indicates that WordPress is unable to fetch the images from their respective folders on your website, which is usually caused by incorrect permissions of the images files or the folders they are located in.
The solution to this is to reset the permissions of the WordPress files and folders to the default ones. This can be done from Site Tools > WordPress > Install & Manage > Manage Installations > Actions menu > Reset Permissions > Confirm.