Ini_set ("upload_max_filesize", "200M") does not work in php

Possible duplicate:
override upload_max_filesize

I use this code to resize the uploaded file: -

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

BUT I SAID

 2M 2M 

which is installed in php.ini.

I want to change the file size limit.

+13
php file-upload
Nov 18 '12 at 16:55
source share
3 answers

upload_max_filesize "2M" PHP_INI_PERDIR

PHP_INI_PERDIR The entry can be set to php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)

Therefore, you cannot use ini_set for this.

+44
Nov 18
source share

You need to increase post_max_size .

To upload large files, this value must be greater than upload_max_filesize

You may also need to increase memory_limit

If memory restriction is enabled using the script configuration, memory_limit also affects file downloads. Generally speaking, memory_limit should be larger than post_max_size.

As others have pointed out, upload_max_filesize cannot be changed at runtime (using ini_set ). However, once you change it correctly, you will still need to increase these values.

+5
Nov 18 '12 at 16:59
source share

The PHP documentation says:

The available options are K (for Kilobytes), M (for megabytes) and G (for Gigabytes, available with PHP 5.1.0), they are case insensitive. Everything else takes bytes. 1M is equal to one megabyte or 1048576 bytes. 1K is equal to one kilobyte or 1024 bytes. You cannot use these abbreviations outside php.ini, use an integer byte value instead .

+2
Nov 18 '12 at 17:00
source share



All Articles