How to limit size of uploaded files?
Posted: Wed Jun 18, 2008 12:14 pm
I'm a newbie to PHP and bought a buggy PHP script, which I've fixed for the most part, but I'm having a difficult time limiting the upload image size on the upload page. I've tried to add code but keeping getting errors. Here's the code I need to limit image size uploads on:
Can anyone suggest a solution?
Thanks!
Code: Select all
if(isset($_POST[s1]))
{
if(!empty($_FILES[images][name][0]))
{
while(list($key,$value) = each($_FILES[images][name]))
{
if(!empty($value))
{
$NewImageName = $t."_offer_".$value;
copy($_FILES[images][tmp_name][$key], "cars_images/".$NewImageName);
$MyImages[] = $NewImageName;
}
}
if(!empty($MyImages))
{
$ImageStr = implode("|", $MyImages);
}
}Thanks!