WordPress.org

Ready to get started?Download WordPress

Forums

Maximum upload file size (15 posts)

  1. mjefferson96
    Member
    Posted 2 years ago #

    I'm trying to increase the Maximum upload file size on some of my accounts. I notice that some have a default of 2MB, others have 8MB and one even has a default of 64MB. I've read all the posts about changing the php.ini and I've tried all of it but nothing has worked.
    So can someone provide a definitive answer on this subject of how to increase the Maximum upload file size?

  2. vtxyzzy
    Member
    Posted 2 years ago #

    There doesn't seem to be one solution that works for all sites/themes. This topic discusses some options:

    http://wordpress.org/support/topic/error-saving-media-attachment-when-file-size-is-over-2mb?replies=5

    A Google search for 'wordpress max upload file size' will find other option.

  3. It's not a theme setting, nor a WordPress one (unless you're on MultiSite). It's your server. You may need to ask your webhost.

    If you make a phpinfo() page, you can scan for max upload size and see what it's set to on your server.

  4. mjefferson96
    Member
    Posted 2 years ago #

    Do you have instructions on how to do that? I would love to know.

  5. mjefferson96
    Member
    Posted 2 years ago #

    ok I can see the info now, but still changing and or appending the the php.ini did not change anything. what to try next?

  6. mjefferson96
    Member
    Posted 2 years ago #

    I just looked at the phpinfo on another wordpress site and it says 8max but wordpress upload says 2max. hmmmmm? whats up with that?

  7. Ask your host. There's more than JUST the phpinfo() to check.

  8. weez1l
    Member
    Posted 2 years ago #

    There's a simpler solution that will work for any host because you're not messing with php.ini or .htaccess. I know this post is outdated, but I was looking and looking, and I figured out this, which works perfectly.

    open wp-admin/includes/template.php
    find the function wp_max_upload_size()
    alter it (I copied, then commented out the existing) like this:

    function wp_max_upload_size() {
    $u_bytes = wp_convert_hr_to_bytes( '1000MB' );
    $p_bytes = wp_convert_hr_to_bytes( '1000MB' );
    $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );
    return $bytes;
    }

    That's for a 1 gb file size. You can make it any size here.

  9. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    open wp-admin/includes/template.php

    No! Never edit WordPress core files.

  10. weez1l
    Member
    Posted 2 years ago #

    is that a copyright issue? I was just testing this out pre-production...

  11. weez1l
    Member
    Posted 2 years ago #

    Well I just read the license agreement and with a comment, it does not violate any terms.
    I should say that you should know some php if you're going to screw with this. This is my workaround to ftp uploads and side-loading links, and I'm going to use it, because I have people that need to upload that don't understand an html link tag.

  12. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    is that a copyright issue?

    No but if you edit core code then, at best, you're going to have to replace that hack every time you upgrade. At worst, you'll bring your entire site down or severely comprise overall site security.

  13. weez1l
    Member
    Posted 2 years ago #

    I actually found that this doesn't entirely solve the problem.
    For example, I uploaded my site to godaddy and found that it spouted html errors and said it was 'crushing' files over 32mb, when the uploader worked fine with those settings locally. I tried media files of a lot of different sizes and found that godaddy's limit appears to be 32mb. I don't know about any other hosting at this point

    TLDR;
    You still have to talk to your hosting if you want very large files or videos to be uploaded.

  14. renoproc
    Member
    Posted 1 year ago #

    A simple example in .htaccess file

    <IfModule mod_php5.c>
    php_value post_max_size           10M
    php_value upload_max_filesize     40M
    php_value memory_limit            500M
    </IfModule>

Topic Closed

This topic has been closed to new replies.

About this Topic