ini_set("upload_max_filesize","200M") 在 php 中不起作用

2021-12-24 00:00:00 file-upload php
<块引用>

可能的重复:
覆盖upload_max_filesize

我使用这些代码来更改上传文件大小:-

echo ini_get('upload_max_filesize').'
';ini_set("upload_max_filesize","300M");echo ini_get("upload_max_filesize");

但是我得到了

2M2M

在 php.ini 中设置.

我想更改文件上传大小限制.

解决方案

  1. http://php.net/manual/en/ini.list.php

<块引用>

upload_max_filesize "2M" PHP_INI_PERDIR

  1. http://php.net/manual/en/configuration.changes.modes.php

<块引用>

PHP_INI_PERDIR 可以在 php.ini、.htaccess、httpd.conf 或 .user.ini 中设置条目(自 PHP 5.3 起)

因此您不能为此使用 ini_set.

Possible Duplicate:
overriding upload_max_filesize

i use these code for change upload file size :-

echo ini_get('upload_max_filesize').'<br/>';
ini_set("upload_max_filesize","300M");
echo ini_get("upload_max_filesize");

BUT I GOT

2M
2M

which is set in php.ini.

i want to change file upload size limit.

解决方案

  1. http://php.net/manual/en/ini.list.php

upload_max_filesize "2M" PHP_INI_PERDIR

  1. http://php.net/manual/en/configuration.changes.modes.php

PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)

So you can't use ini_set for this.

相关文章