Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 831
Maulik patel Avatar asked Nov 18 '12 16:11

Maulik patel


People also ask

What is the maximum upload_max_filesize?

The default PHP values are 2 MB for upload_max_filesize, and 8 MB for post_max_size. Depending on your host, changing these two PHP variables can be done in a number of places with the most likely being php. ini or . htaccess (depending on your hosting situation).

How do I change the maximum upload size in PHP ini?

To increaes file upload size in PHP, you need to modify the upload_max_filesize and post_max_size variable's in your php. ini file. In addition, you can also set the maximum number of files allowed to be uploaded simultaneously, in a single request, using the max_file_uploads .

How do I set the maximum file upload size in PHP?

The best way to modify the maximum file upload size is to set the values in the php.ini file. There are two directives in the php.ini file that you will need to change which are: upload_max_filesize: This is the maximum size of an individual uploaded file. The default value for this is 2MB.

How to fix upload_max_filesize exceeds the directive in PHP?

Another way to get rid of the uploaded file exceeds the upload_max_filesize directive in php.ini error is by tweaking the wp-config.php file located in your root directory. All you need to do is log in to the hPanel and access public_html to edit the wp_config. php file.

How to set upload_max_filesize using INI_set()?

You can't set upload_max_filesize using ini_set () because upload_max_filesize is a PHP_INI_PERDIR type that means changeable only via: php.ini, .htaccess or httpd.conf as stated at: php.net/manual/en/configuration.changes.modes.php Actually, you can use shorthand notation outside of PHP.ini; you can use it in .htaccess and also with ini_set.

What is the “upload_max_filesize” error?

The uploaded file exceeds the upload_max_filesize directive in php.ini is an error that occurs on your WordPress site when you upload a file that exceeds the limitations set by your webserver. As scary as this error may seem, the solutions are pretty straight-forward.


1 Answers

  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.

like image 192
dev-null-dweller Avatar answered Nov 12 '22 20:11

dev-null-dweller