tags:

views:

375

answers:

4

I am trying to increase the value of upload_max_filesize to 10485760 (10M).

I am using:

ini_set('upload_max_filesize',10485760);

This is always returning false and the upload_max_filesize continues to be 2M. I am using php 5.2.8 on windows and I don't have the ini_set disabled and am also not with safe mode on.

Anyone know why this doesn't work? Thanks

+2  A: 

Try editing the value in the php.ini file instead of in your PHP script. Your script may not for whatever reason have permissions to override php.ini.

AriX
I can't do that. I do have access to my own php.ini but in the server I don't, only via ini_set.Any reason for ini_set to fail with upload_max_filesize? I have other ini_set calls and they all seem to work
AntonioCS
upload_max_filesize is marked as PHP_INI_PERDIR in the docs, meaning that it can only be set in php.ini or in a per directory settings file (.htaccess on Apache).
R. Bemrose
To expand on what Mr. Bemrose said, try making a file in your directory called .htaccess and make the contents "php_value upload_max_filesize 10M". If this doesn't work, you'll have to contact your server administrator/host to see if they can get the value changed for you.
AriX
+2  A: 

The upload_max_size setting will be checked before your PHP script starts running. So by the time you change the setting, the upload already failed.

Evert
A: 

is it running in apache (mod_php)? if so there are settings in apache that effect this as well.

The apache webserver has a LimitRequestBody configuration directive that restricts the size of all POST data regardless of the web scripting language in use. Some RPM installations sets limit request body to 512Kb. You will need to change this to a larger value or remove the entry altogether.

nategood
A: 

Check variable [post_max_size][1].

Sets max size of post data allowed. This setting also affects file upload.

Pavels