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.
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]