RE: [PHP] File Upload size limit
You can also do this all in a php file without changing the directives in either .htaccess or the httpd.conf file. Here is a sample: Hope that helps, Josh Thomas RPS Internet Services -Original Message- From: Oliver Schonrock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 13, 2002 2:12 PM To: [EMAIL PROTECTED] Subject: [PHP] File Upload size limit Sorry for bringing up an old problem, (there seem to be many articles in the archives already) but I couldn't find the solution there so here is my version of the problem ;-) I am running php 4.2.2 on a virtual host, so I have no access to php.ini. But I can use the apache directives in .htaccess which has worked well for me so far. So i have the following directives in the .htaccess in the directory where the relevant upload script is located: php_value memory_limit 34M php_value post_max_size 33M php_value upload_max_filesize 32M php_value max_execution_time 600 So I have memory_limit > post_max_size > upload_max_filesize experimentation shows that uploads greater than 8M bomb out. So I check phpinfo() and guess what? It reports post_max_size = 8M. The other 3 config settings have been changed correctly from their master (default) values. but for some reason the post_max_size 33M has been ignored. I know that some priviledges are required to be able to change these settings via .htaccess (namely "AllowOverride Options" or "AllowOverride All" privileges) but i thought that these applied to all the settings. So since I can change the first three why not the last one? Can my host stop me from changing a single config? If so how, and what do they need to change so I can get post_max_size = 33M? Or have i missed something really really stupid? Thanks very much in advance Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload size limit
> No, I mean PHP. The 4.2.2 release was a security fix for 4.2.1 only. > None of the changes for the past couple of months, including this one, is > in it. OK, but you said originally > post_max_size and upload_max_filesize could not be set in your .htaccess > file until recently. It was changed about 3 weeks ago, so unless your > provider is running a recent snapshot, you won't be able to get this to > work. and upload_max_file_size IS being changed by my .htaccess settings...(only post_max_size is not working)?! confused..! 8-) > Yes, you will have them for your whole site. If you want to limit them to > a certain directory or a certain file, tell them to put the settings > inside appropriate or blocks. OK, got it. - Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload size limit
> Thanks for quick response. Just a couple of silly questions: > > - changed where? in php or apache? My host is running the "three week old" > v 4.2.2 of php so I guess you mean apache? No, I mean PHP. The 4.2.2 release was a security fix for 4.2.1 only. None of the changes for the past couple of months, including this one, is in it. > - If I can in fact get them to change it in http.conf for my virtual host > block then I will have these huge (!) settings for my whole site rather > than just the necessary scripts. Is there any downside to this (other than > misbehaved scripts being really misbehaved)? Yes, you will have them for your whole site. If you want to limit them to a certain directory or a certain file, tell them to put the settings inside appropriate or blocks. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload size limit
Thanks for quick response. Just a couple of silly questions: - changed where? in php or apache? My host is running the "three week old" v 4.2.2 of php so I guess you mean apache? - If I can in fact get them to change it in http.conf for my virtual host block then I will have these huge (!) settings for my whole site rather than just the necessary scripts. Is there any downside to this (other than misbehaved scripts being really misbehaved)? Cheers Oliver --On 13 August 2002 14:21 -0700 Rasmus Lerdorf <[EMAIL PROTECTED]> wrote: > post_max_size and upload_max_filesize could not be set in your .htaccess > file until recently. It was changed about 3 weeks ago, so unless your > provider is running a recent snapshot, you won't be able to get this to > work. > > Ask your provider to add those lines to your virtualhost block in the > httpd.conf file. > > -Rasmus > > On Tue, 13 Aug 2002, [ISO-8859-1] Oliver Schönrock wrote: > >> Sorry for bringing up an old problem, (there seem to be many articles in >> the archives already) but I couldn't find the solution there so here is >> my version of the problem ;-) >> >> I am running php 4.2.2 on a virtual host, so I have no access to php.ini. >> But I can use the apache directives in .htaccess which has worked well >> for me so far. So i have the following directives in the .htaccess in the >> directory where the relevant upload script is located: >> >> php_value memory_limit 34M >> php_value post_max_size 33M >> php_value upload_max_filesize 32M >> php_value max_execution_time 600 >> >> So I have memory_limit > post_max_size > upload_max_filesize >> >> experimentation shows that uploads greater than 8M bomb out. So I check >> phpinfo() and guess what? It reports post_max_size = 8M. The other 3 >> config settings have been changed correctly from their master (default) >> values. but for some reason the post_max_size 33M has been ignored. >> >> I know that some priviledges are required to be able to change these >> settings via .htaccess (namely "AllowOverride Options" or "AllowOverride >> All" privileges) but i thought that these applied to all the settings. So >> since I can change the first three why not the last one? >> >> Can my host stop me from changing a single config? If so how, and what do >> they need to change so I can get post_max_size = 33M? >> >> Or have i missed something really really stupid? >> >> Thanks very much in advance >> >> >> Oliver >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> Oliver Schönrock 20 The Gables Old Town, Clapham London SW4 0JX United Kingdom Mobile : +44 7880 617 446 Fax: +44 870 706 5749 email : mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload size limit
post_max_size and upload_max_filesize could not be set in your .htaccess file until recently. It was changed about 3 weeks ago, so unless your provider is running a recent snapshot, you won't be able to get this to work. Ask your provider to add those lines to your virtualhost block in the httpd.conf file. -Rasmus On Tue, 13 Aug 2002, [ISO-8859-1] Oliver Schönrock wrote: > Sorry for bringing up an old problem, (there seem to be many articles in > the archives already) but I couldn't find the solution there so here is my > version of the problem ;-) > > I am running php 4.2.2 on a virtual host, so I have no access to php.ini. > But I can use the apache directives in .htaccess which has worked well for > me so far. So i have the following directives in the .htaccess in the > directory where the relevant upload script is located: > > php_value memory_limit 34M > php_value post_max_size 33M > php_value upload_max_filesize 32M > php_value max_execution_time 600 > > So I have memory_limit > post_max_size > upload_max_filesize > > experimentation shows that uploads greater than 8M bomb out. So I check > phpinfo() and guess what? It reports post_max_size = 8M. The other 3 config > settings have been changed correctly from their master (default) values. > but for some reason the post_max_size 33M has been ignored. > > I know that some priviledges are required to be able to change these > settings via .htaccess (namely "AllowOverride Options" or "AllowOverride > All" privileges) but i thought that these applied to all the settings. So > since I can change the first three why not the last one? > > Can my host stop me from changing a single config? If so how, and what do > they need to change so I can get post_max_size = 33M? > > Or have i missed something really really stupid? > > Thanks very much in advance > > > Oliver > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload Size Limit Problem
If you have been changed your php.ini to accept larger uploaded files. Then there are many possibilities. If you explain what kind of environment you have and it's settings, someone might be able to help you. Regards, -- Yasuo Ohgaki ""Jeff Oien"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > ""Jeff Oien"" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > I've modified a script for uploading multiple files > > > and am trying to get it to produce an error if the > > > size of the file is larger than 2 MB but can't get it > > > to work. Here is the code in question with the > > > who code below. When I try to upload a 3 MB > > > file it doesn't produce an error. Everything else works > > > fine. > > > > You need to edit your php.ini > > Read your php.ini and look for upload_max_filesize. > > > > Regards, > > -- > > Yasuo Ohgaki > > I know my max_file_size 2 MB. > I want to prevent a user from trying to upload a file that > is larger than 3 MB. > Jeff Oien > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] File Upload Size Limit Problem
> ""Jeff Oien"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I've modified a script for uploading multiple files > > and am trying to get it to produce an error if the > > size of the file is larger than 2 MB but can't get it > > to work. Here is the code in question with the > > who code below. When I try to upload a 3 MB > > file it doesn't produce an error. Everything else works > > fine. > > You need to edit your php.ini > Read your php.ini and look for upload_max_filesize. > > Regards, > -- > Yasuo Ohgaki I know my max_file_size 2 MB. I want to prevent a user from trying to upload a file that is larger than 3 MB. Jeff Oien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] File Upload Size Limit Problem
""Jeff Oien"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've modified a script for uploading multiple files > and am trying to get it to produce an error if the > size of the file is larger than 2 MB but can't get it > to work. Here is the code in question with the > who code below. When I try to upload a 3 MB > file it doesn't produce an error. Everything else works > fine. You need to edit your php.ini Read your php.ini and look for upload_max_filesize. Regards, -- Yasuo Ohgaki PHP and Related resources [PHP FAQ] http://www.php.net/FAQ.php [PHP Manual] http://www.php.net/manual/en/ [PHP Links] http://www.php.net/links.php [RFCs] http://www.faqs.org/rfcs/ > Jeff Oien > > if(${"infile".$i}!="none") $noinput=false; > if(${"infile".$i."_size"} > 200) { > echo "Sorry, file size limit is 2MB. ${"infile".$i} is too large."; > exit; > } > > > > /* handle uploads */ > $noinput = true; > for($i=1; $noinput && ($i<=UPLOAD_SLOTS); $i++) > { > if(${"infile".$i}!="none") $noinput=false; > } > if($noinput) > { > echo "Uploading Error"; > exit(); > } > for($i=1; $i<=UPLOAD_SLOTS; $i++) > { > if(${"infile".$i."_size"} > 200) { > echo "Sorry, file size limit is 2MB. ${"infile".$i} is too large."; > exit; > } > > if(${"infile".$i}!="none" && > copy(${"infile".$i}, INCOMING.${"infile".$i."_name"}) && > unlink(${"infile".$i})) > { > if (${"infile".$i."_size"} < 100) { > ${"infile".$i."_size"} = ${"infile".$i."_size"} / 1000; > ${"infile".$i."_size"} = sprintf("%.2f", ${"infile".$i."_size"}); > ${"infile".$i."_size"} = ${"infile".$i."_size"} . ' KB'; > } > else { > ${"infile".$i."_size"} = ${"infile".$i."_size"} / 100; > ${"infile".$i."_size"} = sprintf("%.2f", ${"infile".$i."_size"}); > ${"infile".$i."_size"} = ${"infile".$i."_size"} . ' MB'; > } > echo ${"infile".$i."_name"}." - ${"infile".$i."_size"} uploaded"; > } > } > } /* else */ > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]