[英]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. 我无法将文件上传到1Mb以上的wordpress,因为上传者限制了我。
I have checked the phpinfo() and it showing 1000M but still the wordpress uploader is showing 1Mb as the max upload size. 我已经检查了phpinfo(),它显示了1000M,但wordpress uploader仍然显示1Mb作为最大上传大小。
Strangely i could not update the max_execution time to 1000 even though i have changed the some in php.ini 奇怪的是,即使我更改了php.ini中的一些内容,我也无法将max_execution时间更新为1000
Is there some way the hosting providers are blocking some changes to php.ini file. 托管服务提供商是否有某种方式阻止对php.ini文件的某些更改。
The info as shown here: 信息如下所示:
http://nvoids.com/test.php http://nvoids.com/test.php
http://nvoids.com/blog/wp-admin/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
. WordPress使用两个php.ini值来确定最大上传大小:
upload_max_filesize
和post_max_size
。 See https://github.com/WordPress/WordPress/blob/master/wp-includes/media.php#L1141-L1146 . 参见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:
这是WordPress来源中确定最大上传大小的方法:
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 请将此代码添加到您的function.php文件中
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: 如果您的主机是GoDaddy cPanel,则可以通过更简单的方式更改设置:
- Login to the cPanel Hosting Manager Account
登录到cPanel Hosting Manager帐户
- Search for 'Select PHP Version' option and click into it.
搜索“选择PHP版本”选项,然后单击它。
- In the top right corner click the button 'Switch to PHP Options'
点击右上角的“切换到PHP选项”按钮
- Here modify or change any other settings which you need.
在这里修改或更改您需要的任何其他设置。
For example: 例如:
max_file_size
I have added the screenshots here: 我在这里添加了屏幕截图:
I guess you use multi-site wordpress. 我猜您使用多站点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. php设置由wordpress多站点管理功能重写。 I met the same problem, hope this helps you.
我遇到了同样的问题,希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.