homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Large file uploads in PHP
How to get round the 'uplaod_max_filesize' directive

 11:57 am on Dec 3, 2002 (gmt 0)

Oh dear, oh dear...

Poor, sorry fool that I am, I've just built a nice file upload module for a client and found that my host has the uplaod_max_filesize directive set to 2M in php.ini

I can't change it with ini_set()

Can anyone think of a way round it if my host say they won't change it? (waiting for thier answer)

...and yes, I know I should have thought of this before building it! ;)




 5:33 pm on Dec 3, 2002 (gmt 0)

Hi Nick, sorry to hear that!

Mmm... I'm not sure but if you have access to your virtual hosts config file you might be able to modify the upload_max_filesize from there.

What I do is setup an SFTP or SSH account to transfer files safely.
Then, with a Web interfase I assign and relocate the files where they belong.
I like this method better because it allows me to do batch uploads and I believe it is faster than HTTP upload.
Sure, you can't check the validity of file types before upload, but I wrote a "filtering" program that checks for new files and erases the ones that don't belong there.

Just an idea, hope it helps.


 6:14 pm on Dec 3, 2002 (gmt 0)

php_value upload_max_filesize 5M

will successfully set upload_max_filesize to 5MB. You can verify this by using

echo get_ini('upload_max_filesize');

BUT and thereīs always a but:

:) :) Just because you're able to set something
doesn't mean it will work as expected.
:) :)

upload_max_filesize is a PHP_INI_SYSTEM setting [php.net]. Using php_value with such a directive wonīt work [php.net].

Just give it a try anyway. BUT donīt say I didnīt warn you that it probably wonīt work. set all you want, just donīt expect it to work. code anything you want, but donīt expect it to work. Is that the official PHP motto?

:) Andreas


 6:17 pm on Dec 3, 2002 (gmt 0)

Did you realize: Itīs x-mas season! Red font and green smilies. :)



 6:17 pm on Dec 3, 2002 (gmt 0)

No you can't set it that way. It's only setable through the php.ini

Actually my host says he has it set to this:

upload_max_filesize 100000000

Which I think may be the problem, every other reference I've seen to it always has the value like: 100M

Off to read up...

THanks for the thoughts guys...



 6:24 pm on Dec 3, 2002 (gmt 0)

You can specify sizes either in bytes without any postfix or a number using a postfix like M for mega byte. There are others.

BTW, you can set 'upload_max_filesize' this way. It just has no effect.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved