WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Max upload file size (12 posts)

  1. boggy_bg
    Member
    Posted 3 years ago #

    Hi,

    I cannot find the option for maximum file size limit.

    I am using normal (not MU) installation and last version of WP.

    Thank you in advance,

    Bogdan

  2. jkovis
    Member
    Posted 3 years ago #

    I'm pretty sure the max upload size on a non-network WordPress install comes from php.ini, not WordPress.

    Are you getting an error when you try to upload a large file? If yes, what is the error?

  3. Joni
    Member
    Posted 3 years ago #

    That's generally set by your web host and quite a few limit to 8MB. You can ask them to increase that for you. You cannot set this in the wp-config.php file. You can try to override your server settings using php.ini, but the best route is to ask them to increase it for you to 16MB or even 32MB.

  4. boggy_bg
    Member
    Posted 3 years ago #

    In the file upload layer, one read "maximum file upload: 2 MB" and if I try to upload bigger file, the error message is: "this file is over the maximum allowed size" (sorry, my installation is Bulgarian and I translate back to English)

  5. jkovis
    Member
    Posted 3 years ago #

    "this file is over the maximum allowed size"

    - yep, php.ini. As @jonimueller said, it's probably controlled by your host

  6. boggy_bg
    Member
    Posted 3 years ago #

    Thank you very much, that's it!

    So, WordPress doesn't pose any limitations in this respect?!

  7. jkovis
    Member
    Posted 3 years ago #

    You can hook into upload_size_limit

  8. boggy_bg
    Member
    Posted 3 years ago #

    Now, I changed php.ini (on my local server) to 200MB and nothing changed, then I tried the remote installation and nothing either.

    Seemingly it requires some hack, but I am a little newbie to WordPress to apply correct hack.

    @jjkovis: thank you for your support, but I lack of experience to apply the hack

  9. jkovis
    Member
    Posted 3 years ago #

    I forgot that you need to change post_max_size as well as upload_max_filesize

    Seemingly it requires some hack

    - using hooks are not hacks as the make it so you don't have to hack core WordPress files

  10. boggy_bg
    Member
    Posted 3 years ago #

    I tried both of them in my php.ini (local server: wamp x64, Win 7 x64) and nothing happened.

    Are you sure there is no option in WP to limit that?

  11. jkovis
    Member
    Posted 3 years ago #

    hmm...did you try restarting the server after changing the values?

    Are you sure there is no option in WP to limit that?

    - I'm pretty sure, here is the function the flash uploader uses to determine the max upload size:

    function wp_max_upload_size() {
          $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
          $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
          $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );
    
          return $bytes;
     }
  12. boggy_bg
    Member
    Posted 3 years ago #

    I am really, really thankful!

    After the restart, everything goes well.

    I wish you all the success,

    Bogdan

Topic Closed

This topic has been closed to new replies.

About this Topic