AntonioCS
AntonioCS

Reputation: 8496

upload_max_filesize not changing

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

Upvotes: 1

Views: 3028

Answers (5)

derogab
derogab

Reputation: 152

Try this:

ini_set('upload_max_filesize','100M');

Upvotes: 0

Pavels
Pavels

Reputation: 1316

Check variable [post_max_size][1].

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

Upvotes: 0

nategood
nategood

Reputation: 12005

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.

Upvotes: -1

Evert
Evert

Reputation: 99495

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.

Upvotes: 5

AriX
AriX

Reputation: 1687

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.

Upvotes: 3

Related Questions