Re: File Upload Size Limit Problem

From: Date: Sun, 11 Mar 2001 03:01:43 +0000
Subject: Re: File Upload Size Limit Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43364@lists.php.net to get a copy of this message
""Jeff Oien"" <jeff@webdesigns1.com> wrote in message news:NDBBJKNCILKDCEGAJBAOCEHJDGAA.jeff@webdesigns1.com... > 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"} > 2000000) { > 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"} > 2000000) { > 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"} < 1000000) { > ${"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"} / > 1000000; > ${"infile".$i."_size"} = sprintf("%.2f", > ${"infile".$i."_size"}); > ${"infile".$i."_size"} = ${"infile".$i."_size"} . > ' MB'; > } > echo ${"infile".$i."_name"}." - > ${"infile".$i."_size"} uploaded<br>"; > } > } > } /* else */ > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#43364) next »