简体   繁体   中英

wordpress upload file and php max file size

I m not able to upload files to wordpress beyond 1Mb as the uploader is limiting me.

I have checked the phpinfo() and it showing 1000M but still the wordpress uploader is showing 1Mb as the max upload size.

Strangely i could not update the max_execution time to 1000 even though i have changed the some in php.ini

Is there some way the hosting providers are blocking some changes to php.ini file.

The info as shown here:

http://nvoids.com/test.php

http://nvoids.com/blog/wp-admin/test.php

thanks

WordPress uses two php.ini values to determine the max upload size: upload_max_filesize and post_max_size . See https://github.com/WordPress/WordPress/blob/master/wp-includes/media.php#L1141-L1146 . Here's the method from WordPress's source that determines 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;
}

Please add this code in your function.php file

add_filter('upload_size_limit','ashutosh_increase_upload');
    function ashutosh_increase_upload($bytes){
    return 2650000000; 
}

You can change the settings the easier way if your host is GoDaddy cPanel:

  • Login to the cPanel Hosting Manager Account
  • Search for 'Select PHP Version' option and click into it.
  • In the top right corner click the button 'Switch to PHP Options'
  • Here modify or change any other settings which you need.

For example:

max_file_size

I have added the screenshots here:

第2步第三步第四步

I guess you use multi-site wordpress. In this case, you can set "Max upload file size" in
Network Admin -> Settings -> Network Settings.
The php setting is rewritten by the wordpress multi-site manangement function. I met the same problem, hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM