Wordpress Upload: Unexpected response from the server. The file may have been uploaded successfully.

Discussion in 'General' started by decentris, Mar 21, 2020.

  1. decentris

    decentris Member HowtoForge Supporter

    Hi team,

    I got a dedicated machine with ubuntu / apache / mysql and correctly set php.ini to 256M max-upload size. Also I increased memory-limit to 1024M and post-max-size to 512M, which should be sufficient to upload an 150M MP4 video-file. Also I increased max_execution_time, max_input_vars and max_input_time to 5000.

    But I am always running into the error "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page“, when I try to upload a file bigger than 128M. Wordpress-Version is 5.3.2.
    I also downgraded to WP 4.9.8 and there the error is simply called "HTTP error."

    I also did the php.ini global setting in /etc/php/7.2 for upload size in the server-config and I am using only a WAF from Stackpath, which doesn’t limit the upload limit (tested it by redirecting to the original-IP via local hosts-file). Also I use GD-library instead of ImageMagick for image manipulation.

    As it is an “apache2”-webhost and no nginx, I also haven't got the option with the “client_max_body_size”-parameter.

    But it MUST be something in the server-setting, because I have already tested and filtered out any other possible culprit (WAF, WP-Version and deactivated all Plugins and switched back to twentytwenty-theme).

    So I am at the very end of my knowledge.

    Maybe some of you has an idea how to solve this.

    Thanks a lot in advance.
  2. Steini86

    Steini86 Active Member

    Create a php file with
    Look what upload limits are set and which php config files are used.
    In general, I would suggest to upload such large files via better methods (FTPS / SFTP / SCP / RSYNC)
  3. decentris

    decentris Member HowtoForge Supporter

    Hi Steini86,
    thanks for the tip. Yes, I know and already tested my php.ini settings. They are like described above. max_upload_limit and all other important settings have been made. This is the strange thing, which I don't get.

    When I upload files fith FTPS (wich I am using), and add it via the "Add-from-Server" plugin, the "Media-Vault"-Plugin is not working for these files. That's why I need to upload them via the WP Media Library.
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    unless this is for a private site, which only a very few people will view (especially concurrently), or you have one hell of a server, with a LOT of memory, and a very large direct connection to the internet, you should not upload a video file like that into wordpress.
    if even only a couple of visitors start viewing the video, it's likely to overwhelm your servers resources, or use your entire available bandwidth.
    the better option would be to upload the video file to a video sharing site like youtube or vimeo, and then embed the video as a link in your wordpress page. you can keep it private on the video sharing site, with the credentials embedded within the link.
    this way the video is kept on a system that's designed to handle the load/bandwidth requirements. so you can get away with using much smaller server, and you're not paying out so much for the internet bandwidth/traffic, and it also completely bypasses your problem with uploading such a large file into wordpress.
  5. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    it seems like Wordpress has a default memory limit itself, try
    define( 'WP_MEMORY_LIMIT', '1024M' );
  6. elmacus

    elmacus Active Member HowtoForge Supporter

    You must change two settings in PHP.ini atleast:
    post_max_size = 256M
    upload_max_filesize = 256M
    Make a PHP directive snippet of these in ISPconfig System.

Share This Page