42

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 🙌

7
  • did you try to rule out any other plugin / theme conflicts ? can you try the same upload on same installation with no other plugins / default theme ? Jan 26, 2020 at 7:01
  • Yes, it doesn't seem to be plugin/theme issues although the theme I used did have some issues on the site, I don't think they are related. Jan 30, 2020 at 7:29
  • 1
    I also am having the exact same problem with the exact same scenario except i'm using nginx instead of apache. I manually changed my upload sizes on all three fronts. the fact that you are getting this in your LAMP stack and I am getting it in my LEMP stack, makes me think that the issue is not Apache or Nginx, but more likely php, or wordpress. Did you ever figure this issue out?
    – DanRan
    Feb 9, 2020 at 4:32
  • Yeah, it is the CDN, apparently, some CDN also poses POST request limit and disabling CDN works. Feb 11, 2020 at 7:53
  • 1
    It won't let me post an answer because I don't have points. However, to anyone reading this, I had the Modsecurity plugin activated and that was the cause. Had to temporarily deactivate it to upload the mp4 file.
    – DanRan
    Dec 11, 2021 at 9:33

14 Answers 14

36

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;
6
  • Thanks. My server runs Nginx and this worked for me, Apr 7, 2021 at 10:00
  • 3
    This solution worked also for me. Thanks. A small clarification: You need to add the line @EliasDiek mentioned to the nginx.conf file in /etc/nginx/ folder. And I added the line into http { } part.
    – aademirci
    May 28, 2021 at 12:09
  • This. Kept looking in PHP.ini all while forgetting this. Sep 15, 2021 at 14:36
  • 2
    Friendly reminder to all, after editing /etc/nginx/nginx.conf a restart (graceful preferred) is needed via "sudo systemctl reload nginx"
    – Art Geigel
    Jan 11, 2022 at 19:43
  • Outstanding- thanks for that!
    – F1Linux
    May 23, 2022 at 10:01
12

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 :D

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

Solution: 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.

2
  • 1
    Yes absolutely correct, from the error it is obviously not coming from PHP or Wordpress. It is more like nginx terminating the request because of size limit. So, you must have to increase max upload size in your PHP config then you must also direct nginx to allow using by specify client_max_body_size.
    – Don Pels
    Jun 20, 2021 at 7:14
  • 1
    I thought I was getting crazy; I was even looking in the codec used to compress a video. Thanks for sharing your take on this!
    – jrgd
    Oct 25, 2022 at 14:36
10

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.
1
  • Oh, I have not considered that CDN poses a limit on uploads, that helps a lot, thank you! Feb 11, 2020 at 7:50
8

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!

https://wordpress.org/support/plugin/tuxedo-big-file-uploads/reviews/

2
  • 2
    This is it! This was the fix for an issue I had uploading an mp3 Apr 21, 2022 at 17:22
  • 1
    Awesome! So glad it helped! Apr 22, 2022 at 18:09
6

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

2
  • 2
    This did the trick for me. Turns out AIOWPS puts a "LimitRequestBody" on .htaccess. I overrode it and it worked. Aug 18, 2020 at 2:46
  • This turned out to be my issue, too. Thanks for the heads up :) By the way, the current version of the plugin (as of the time of this comment) allows for changing the limit in the Firewall settings page so overriding it was simple.
    – jsmod
    Jan 11, 2021 at 19:29
4

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)

3

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

1
  • I don't have the plugin installed, I set all limits manually on the server using SSH/SFTP so it should be the correct host configuration. Jan 30, 2020 at 7:28
2

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.

3
  • 2
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 19, 2022 at 9:53
  • 3
    This answer asissted me - it was not a font issue but rather 'This file claims compliance with the PDF/A standard and has been opened read-only' - had to click 'Enable Editing' then save and re-upload to WP worked
    – wal
    Mar 1, 2022 at 21:49
  • ran into this problem again (and stumbled on my own comment to assist) - if you run into this error and its not a font or this fils claims compliance issue you can simply 'save as' the pdf and it might fix your problem - i.e. you just tickle the document
    – wal
    Apr 8 at 0:13
2

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.

1
  • I completely disagree with the comment above. We had the exact problem described in the OP. It was solved by carrying out exactly the solution I have added in my answer. It might not be the only solution, but it worked in our case. It is therefore not inconceivable that it might solve things for others.
    – SYPOMark
    Jul 18, 2022 at 9:12
1

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.

1

I also faced the same error. I just deactivated the wordfence security plugin and now it's work fine. Hope help someone.

1

For those of you using All In One WordPress Security;

Disable and re-enabling this security plugin should solve the issue.

0

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.

0

I've tried everything from this list, read 2 google pages of results and nothing solved my problem.

Then after a few days, I've decided to reset permissions on my uploads folder to 777 and back to 755 with FileZilla and I was able to get rid of this error.

Maybe it will be helpful for someone that stumbles upon this post. Good luck :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.