"An error occurred in the upload. Please try again later." How to fix the error in Wordpress.
Wordpress has become a powerhouse in the Content Management Systems ecosystem, currently powering close to 40% of all websites on the internet. As a Wordpress user you’ll likely encounter various, often when lacking the latest updates, one of which being the very common “An error occurred in the upload. Please try again later”.
While it’s a frustrating error, there are a few steps that can be undertaken in order to solve it. Let’s dive in.
Check File Permissions
One of the first few things to check when you encounter the “An error occurred in the upload. Please try again later” message are the file permissions on your hosting server. In order for Wordpress to successfully upload files to your site, it needs certain permissions that might be wrongly set.
To check these settings, you can use a FTP client, such as FileZilla to connect to your hosting. You should then navigate to the folder you’re trying to upload files to and check for the permissions. The folder’s permissions should be 755 and the files should have a permission of 644.
In case they’re incorrectly set, you can use your FTP client to right-click on the folder or on the file and select the option “File Permissions” or “Chmod”. Set them to the above values and you’re good to go.
PHP memory limit
Your Wordpress websites run on PHP and sometimes, if PHP’s memory limit is set too low, you are unable to upload media files and once again, receive the “An error occurred in the upload. Please try again later. Fortunately, this issue can be easily solved by increasing the PHP memory limit by going to your wp-config.php file (you can find it in your main Wordpress folder on the hosting server) and adding this line of code:
File Size Limit
Wordpress installations have a default file size, often set to 2MB, which applies to media uploads. When you try to upload a file which exceeds the limit, Wordpress throws an error. To easily solve this, you can increase the file size limit in the Wordpress config file by adding the following three lines of code to your functions.php file:
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
Wordpress has millions of plugins in its ecosystem and unfortunately, some of them are not well maintained across Wordpress versions. Sometimes you’ll encounter the “An error occurred in the upload. Please try again later” message because one of your plugins is not supported by your WP version and you will need to test which one is the culprit, one by one.
In order to disable your plugins, access the “Plugins” page on your Wordpress dashboard and select all your plugins. Then, select “Deactivate” from the drop–down menu “Bulk Actions” and click “Apply”. Try uploading the same files once again to see if your error was resolved or still persists.
In case the error has been resolved, you can reactivate the plugins one at a time to identify which one was causing the issue. After you identify the problematic plugin installation, you have two options: either replace it with a new one (Wordpress offers a wide array of plugin alternatives in its market) or contact the developer of the plugin and ask for support.
The “An error occurred in the upload. Please try again later” error is particularly common for Wordpress installations and you can solve it by trying one of the above mentioned fixes.
In case the error persists after trying the outlined methods, try reaching out to your hosting provider or to Wordpress support to assist you.
Oftentimes, you can avoid running into this error by keeping your Wordpress installation up-to-date.