WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP limits uploads although settings in PHP.ini state otherwise (7 posts)

  1. emsone
    Member
    Posted 2 years ago #

    Dear All,

    I'm experiencing a strange behaviour from WP. Attemps to upload files bigger than 1M are rejected by WP. My PHP settings are:

    upload_max_filesize 40M
    post_max_size 40M
    max_execution_time 30
    max_input_time 60

    Calling phpinfo() confirms these values.

    Nonetheless below the media library upload form the upload limit of 1M is given. WP refuses to accept any file larger than 1M.

    I've tested uploads with a standalone php script and it works just fine for files larger than 1M.

    What do I miss? Any help would be highly appreciated!

    I'm running a WP v3.3.2 multisite installation on a Linux/Apache server, PHP Version 5.2.6-1.

    Thanks in advance
    Cheers
    Henry

  2. emsone
    Member
    Posted 2 years ago #

    Still stuck with the problem. No suggestions? Thanks!

  3. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 2 years ago #

    look in network settings & try changing the value for site upload space

  4. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    I you are running this server see this:

    http://php.net/manual/en/configuration.changes.php

    If not, contact the web host and discuss.

  5. emsone
    Member
    Posted 2 years ago #

    Thanks for your answers!

    @cubecolor: i didn't know about this setting and it helped to a certain degree. now i get a limit of 2M :)

    I tried to chase down the source for the limit in the WP core files and ended up in the ms.php file at the following function:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser. ]

    function upload_size_limit_filter( $size ) {
    $fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 );
    if ( get_site_option( 'upload_space_check_disabled' ) )
      return min( $size, $fileupload_maxk );
    return min( $size, $fileupload_maxk, get_upload_space_available() );
    }

    The return value of get_site_option( 'fileupload_maxk', 1500 ) is exactly the parameter cubecolor pointed out. However, the function obviously is called with a $size parameter holding the value 2M. I have to admit my knowledge of WP is not good enough to figure out, where this parameter comes from. AFAIK the upload_size_limit_filter function is tied to the filter upload_size_limit. But when I check for where this filter is applied I only find a call with 3 parameters (template.php:801) and all three params do not hold a value of 2M (I checked!).

    So on the bottom line I'm kinda put off. When I hardcode the return value of the upload_size_limit_filter function to 40*1024*1024 WP allows me to upload files of sizes up to 40M just fine.

    Any thoughts on that?

    Cheers
    Henry

  6. emsone
    Member
    Posted 2 years ago #

    I'm wrong, $size = 40M. It's the return value of get_upload_space_available(). Weird...

    Will dig deeper later. Gotta catch some sleep for now :)

    Cheers

  7. emsone
    Member
    Posted 2 years ago #

    K, so finally I figured everything is working correctly. I simply didn't know how to properly use the multisite network settings. The experienced restrictions were quickly removed by entering appropriate values in the file upload settings section...

    Thanks for all your input!

    Cheers
    Henry

Topic Closed

This topic has been closed to new replies.

About this Topic