The WordPress website has an issue with image uploads. When we attempted to upload any image through the media manager.
It portrayed the error “An error occurred in the upload. please try again later.” We were able to resolve this issue after several attempts.
There could be a few reasons for this error, so you will have to try it again. There are several possible solutions to this problem listed below.
Uploading images in WordPress causes an HTTP error named “an error occurred in the upload please try again later”
HTTP errors indicate that something went wrong during a file upload in WordPress. It usually happens when you try to add an image or other type of file to the media library. The solution to this problem is covered in no particular order in this guide. Let’s begin, without further ado!
1. Check Permissions
Ensure that the upload folder’s permissions are set to 755. Although it worked in our case, at times the permissions of the ‘upload’ folder may change due to some unexpected changes on the server.
2. The Culprit Plugins
This issue may be caused by one or more of the recently installed plugins on your WordPress website. Our error was caused by a recently installed plugin for image optimization. We were able to upload the image without any problems after deactivating the culprit plugin.
Try searching for an alternative image optimizer plugin if the HTTP error “an error occurred in the upload please try again later” disappears. To troubleshoot the error further, you could contact the plugin developers.
3. Increase the WordPress memory limit
HTTP errors are commonly caused by insufficient memory in WordPress. Other issues can also arise, such as the 503 service unavailable error. You can fix low memory by adding the following line to your wp-config.php file:
define (‘WP_MEMORY_LIMIT’, ‘256M’);
This code increases PHP’s memory limit to 256MB. Before adding it, check the PHP information for your server’s maximum memory limit.
4. Editing the .htaccess file
A .htaccess file resides in the root folder of your WordPress installation and acts as a gatekeeper for all sorts of things. A number of functions are controlled by it, including where requests go
Add the following code to .htaccess to fix the HTTP error in WordPress:
SetEnv MAGICK_THREAD_LIMIT 1
When you have completed this step, try adding your file again to see if the problem has been resolved. You can test these code snippets if it does not work:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
or
# Exclude the file upload and WP CRON scripts from authentication
<FilesMatch “(async-upload\.php|wp-cron\.php|xmlrpc\.php)$”>
Satisfy Any
Order allow,deny
Allow from all
Deny from none
</FilesMatch>
You may want to try implementing them individually, saving your changes, and reuploading your media file.
5. Make sure your cache is cleared
Do you still experience the WordPress HTTP error after trying all the solutions listed above? The “error” you see may have been solved a while ago, but it comes from the local cache. Try clearing your browser cache before you decide there is no solution.
Read more on How to Secure WordPress Website from Different Cyber Threats?
In order to make your WordPress website more secure, you should have a highly professional experienced team of developers perform a Pentest and vulnerability assessment. Nuox Technologies has vast experience in performing Cyber Security assessments using proven methodologies. All their dedicated team members hold certifications and are equipped with all the latest tools and techniques to enhance your security posture.
Conclusion
It’s not the best feeling when you get the HTTP error when uploading images to WordPress. Nonetheless, we are confident that one of the above solutions will resolve this error for good.
Have you encountered the WordPress HTTP error “an error occurred in the upload. Please try again later.” before? Feel free to share your experiences in the comment section below.