嗨,我是WordPress的初学者,目前正在尝试增加我的文件上传大小。
到目前为止,我已经尝试了两种方法:
第一种方法是将其添加到函数的底部。php文件:
@ini_set( \'upload_max_filesize\' , \'64M\' );
@ini_set( \'post_max_size\', \'64M\');
@ini_set( \'max_execution_time\', \'300\' );
这似乎不起作用。
我尝试的第二种方法是安装PHP设置插件并将其添加到文件中
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
但是,当我尝试通过单击
Media > Add New
, 我仍然认为8MB是最大文件大小:
我该怎么做?我正在尝试上传一个8MB以上的主题,但由于这个限制,它无法正常工作。
P、 我正在使用MAMP启动我的服务器。
最合适的回答,由SO网友:vikrant zilpe 整理而成
1] To do this, change the upload_max_filesize and post_max_size directives in your php.ini file.
To ensure that file uploads work correctly, the post_max_size directive should be a little larger than the upload_max_filesize. For example, the following settings demonstrate how to set a file upload limit to 20 megabytes:
upload\\u max\\u filesize=20M
post\\u max\\u size=21M
2] You need to add the following codes at the bottom of the .htaccess file:
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300
ref links: https://kinsta.com/blog/wordpress-maximum-upload-file-size/ https://kinsta.com/blog/wordpress-maximum-upload-file-size/