Q:

ini_set("upload_max_filesize","200M") not working in php

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.

A:

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

upload_max_filesize   "2M"    PHP_INI_PERDIR

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.

A:

You need to increase post_max_size as well.

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

You may also need to increase memory_limit

If memory limit is enabled by your configure script, memory_limit also affects file uploading. 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 have changed it correctly you will still need to increase these values.

A:

PHP documentation says:

The available options are K (for Kilobytes), M (for Megabytes) and G (for Gigabytes; available since PHP 5.1.0), these are case insensitive. Anything else assumes bytes. 1M equals one Megabyte or 1048576 bytes. 1K equals one Kilobyte or 1024 bytes. You may not use these shorthand notations outside of php.ini, instead use an integer value of bytes.

