无法上传大于8MB的文件 [英] Can't upload files bigger than 8MB
问题描述
我已阅读并尝试过所有与此相关的答案,但无济于事。
是我在PHP中尝试的。 ini:
file_uploads = On
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 100M
在Apache中:
< Directory / var / www / uploads>
php_value upload_max_filesize 10G
php_value post_max_size 10G
< / Directory>
我可能尝试了一些其他的东西, b
$ b
我也想提一下,8MB以下的所有内容都没有问题。此外,超时也不是问题,因为仅仅几秒钟上传失败。
我正在使用Cloudflare。难道这就是阻止我的上传吗?
通过创建一个test.php文件来确认您的PHP.ini的位置与phpinfo()在里面。接下来,检查你的Apache(LimitRequestBody指令*)和php.ini(upload_max_filesize)限制,所以通常情况下这些限制都设置得更高。值以字节为单位。
Apache 2.0的默认上传大小为524288,位于php的include file/etc/httpd/conf.d/php.conf ,要覆盖这个值,把下面的指令放在你的httpd.conf虚拟主机指令中:
< Files * .php>
LimitRequestBody 30000000
< / Files>
(这个例子限制请求正文为30M)
Apache 1.3没有这个默认设置,所以你通常只需要改变php.ini(upload_max_filesize,post_max_size)和config.ini(maxuploadfilesize)的值即可。
最后,检查RequestReadTimeout设置。更多 https://serverfault.com/a/260389
I'm trying to make a file upload script and I've been struggling with this problem for a while.
I've read and tried all the SO answers related to this, but to no avail.
Here is what I tried in php. ini:
file_uploads = On
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 100M
In Apache I have:
<Directory /var/www/uploads>
php_value upload_max_filesize 10G
php_value post_max_size 10G
</Directory>
I might have tried something else that doesn't come to mind right now.
I also want to mention that everything under 8MB is uploaded without a problem. Also timeout isn't a problem either as the upload fails in just a few seconds.
P.S. I'm using Cloudflare. Could it be that this is what's blocking my upload?
Confirm your location of PHP.ini by creating a test.php file with phpinfo() in it.
Next, check your Apache (LimitRequestBody directive*) and php.ini (upload_max_filesize) limits, so normally those are set higher. Value is in bytes.
Apache 2.0 has a default upload size of 524288,found in the php "include file" /etc/httpd/conf.d/php.conf, to override this value, place the following directive in your httpd.conf virtual host directive:
<Files *.php>
LimitRequestBody 30000000
</Files>
(This example limits request body to 30M)
Apache 1.3 does not have this default, and so you normally have to change only the php.ini (upload_max_filesize,post_max_size) values and the config.ini (maxuploadfilesize) value.
Finally, check RequestReadTimeout setting. More at https://serverfault.com/a/260389
这篇关于无法上传大于8MB的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!