WordPress: Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page

Does anyone know what this error message on WordPress means?

Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.

I couldn’t find any errors that I can think of.

This happened when I tried to upload an MP4 file that is about 200MB in size. I have set my WordPress to accept MP4 of up to 5GB so that shouldn’t be a problem, I am using WordPress Multisite installation on Ubuntu 16.04.

In my php.ini I have set the max upload size to 50GB and max post size to 50GB too and I also set the max memory to 1GB. But it just kept sending me that error and I have no idea where to look. All it says was an unexpected response and I have no idea what response that might be.

I can upload MP4 with a size of 27MB with no problem, I know the default WordPress setting is 20MB so I’m pretty sure the size isn’t the problem.

I have also check that the file wasn’t corrupted, it was working fine on my computer as well as YouTube.

I tried restarting PHP (PHP-FPM) and Apache2 but it doesn’t seem to be working.

Does anyone has an idea of what is going on? Thanks 🙌

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

I think my answer is too late. but I would like to post a solution for anyone still looking for a solution for this issue on WordPress running on Nginx.
You should add the following directive to set the maximum allowed size in HTTP(server/location) section.

client_max_body_size 10M;

Solution 2

The mentioned error is generic, it may refer to more than one possibility, so check this out:

  • Maybe you enabled Cloudflare with basic plan in your hosting, if so, Cloudflare limits the upload to 100 MB.
  • Maybe you mixed content on your website, with some pages refering to http and other pages refering to https. If so, please check the link: https://websitesetup.org/http-to-https-wordpress.
  • Maybe you installed security plugin.

Solution 3

Deactivating “All in one WP security” did the trick. You can re-enable it after the upload.

Solution 4

I have understood why this WordPress error occurs "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.", atleast in my case 😀

If you can upload any other file except this specific one, then it is an issue with the file’s size.

In my case everything was correct – upload limits, post_max_size, memory_limit etc but if you are using NGINX, the possible issue is with client_max_body_size

Step 1: In your nginx.conf file, increase the value of "client_max_body_size" to 256M (or more as needed).
Step 2: Restart nginx.

Now you can reload the media library and try uploading the file again. To be on the safe side, rename your file before uploading.

Solution 5

I had the same issue and tried all of the solutions above but had no luck. I ended up using this plugin and it worked automatically. No idea why bc I didn’t increase the max upload size or anything. I noticed in their reviews someone else had the same issue. So hopefully it’ll help someone else out there!


Solution 6

This appears to be an issue with the newer versions of WordPress themselves, rather than anything server side.
It appears to be a known issue to WordPress developers that is being investigated (eg: https://core.trac.wordpress.org/ticket/48778)

Solution 7

I faced the same error and finally it was fixed.
you may installed maximum upload plugins and its configuration is different than your host configuration, for example: if you set max upload from the plugin to 512M and your host configuration is 64, your browser will show your maximum upload as 512M not 64, but later after uploading the unexpected error will display.
the solution : remove the max upload plugin as it my conflict with configuration.
and if you host your website with shared server service, call the support to update the max upload size for you

Solution 8

I had the same problem a number of times and again today. My client was trying to upload PDF’s to the media library that were not large and he was getting the error message "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" The files were mostly around 1.6mb. Some worked, some didn’t. They would upload but the preview of the file would not show in the media library. I tried using the Browser upload method also. Same result only once the upload completed we would get a 404 page not found error.

Ultimately I figured out the issue was an unsupported font used in the PDF files called ZeitungPro-Regular. When I opened the file in Adobe Acrobat DC Adobe showed the error message "Unrecognized font". I switched over to edit mode and changed the font to Arial Narrow as a test. Saved it and uploaded it and it worked! The issue was not with the server or the site set up, the issue was that WordPress could not process that font after uploading the file. If you are getting the "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" check the file you are uploading carefully.

Solution 9

For people using the Wordfence security plugin, I had the same issue combined to other listed here. Max upload size, nginx client_max_body_size, it finally worked but only for admins.
Then I had to switch the Wordfence firewall in learning mode and let users upload their large file, and turn the firewall back to production mode. Long calls to admin ajax were blocked.
Hope this helps.

Solution 10

I came looking for a solution to this same problem. What caused the problem was an apostrophe in the file name. Simply removing that allowed the same file to upload without an issue.

Solution 11

I had the same problem on Windows when I upgraded PHP to a newer version.
The problem was that the /logs and /tmp folders did not exist in the new PHP folder as it was set to c:\php\logs and c:\php\tmp in the php.ini file.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply