Override upload_max_filesize

I'm trying to override my upload_max_filesize in php, but still get the value that is in my php.ini file, which is 2 mb.

 ini_set('upload_max_filesize','30M'); ini_set('post_max_size','30M'); echo("<br>".ini_get('upload_max_filesize')."<br>"); 
+22
file php upload
Jun 04 '09 at 9:12
source share
1 answer

These settings will have no effect when configured through ini_set .

The reason is that PHP needs these values ​​before your script is even executed. When loading occurs, the script target is executed when loading is complete, so PHP must know the maximum sizes in advance.

Install them in php.ini , your virtual host configuration, or in a .htaccess file. A typical .htaccess file would look like this:

 php_value post_max_size 30M php_value upload_max_filesize 30M 
+47
Jun 04 '09 at 9:16
source share



All Articles