Welcome to WebmasterWorld Guest from 54.163.115.193

Forum Moderators: coopster & jatar k

Large file uploads in PHP

How to get round the 'uplaod_max_filesize' directive

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

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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! ;)

Nick

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

10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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

Andreas

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

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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...

Nick

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

WebmasterWorld Senior Member 10+ Year Member



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.

Andreas

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month