简体   繁体   English

仅更改一个特定 PHP 脚本的上传大小

[英]Change upload size for one specific PHP script only

I'm aware of the upload size settings in php.ini, but that's not what I'm asking for.我知道 php.ini 中的上传大小设置,但这不是我要的。 My situation: in my php.ini a reasonable upload size of about 10M is defined which is used globally and for all PHP scripts and which I want to left unchanged for the whole system.我的情况:在我的 php.ini 中,定义了大约 10M 的合理上传大小,该大小在全局和所有 PHP 脚本中使用,并且我希望在整个系统中保持不变。

Now I have exactly one PHP script where I would like to allow a much larger upload size.现在我只有一个 PHP 脚本,我想允许更大的上传大小。 My question: how can I do that without changing the maximum upload size for the whole system?我的问题:如何在不更改整个系统的最大上传大小的情况下做到这一点? Means is there a way to modify this for just one single script and to leave the size untouched for all other ones?意味着有没有办法只为一个脚本修改它,而让所有其他脚本的大小保持不变?

Thanks!谢谢!

您可以在 php 文件的顶部添加这一行。

ini_set(upload_max_filesize, "4000M");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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