// check that the file we are working on really was an HTTP uploadforeach($active_keys as $key){ @is_uploaded_file($_FILES[$fieldname]['tmp_name'][$key]) or error($_FILES[$fieldname]['tmp_name'][$key].' not an HTTP upload', $uploadForm);}

// validation... since this is an image upload script we // should run a check to make sure the upload is an imageforeach($active_keys as $key){ @getimagesize($_FILES[$fieldname]['tmp_name'][$key]) or error($_FILES[$fieldname]['tmp_name'][$key].' not an image', $uploadForm);}

// make a unique filename for the uploaded file and check it is // not taken... if it is keep trying until we find a vacant oneforeach($active_keys as $key){ $now = time(); while(file_exists($uploadFilename[$key] = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name'][$key])) { $now++;

}}//$key$key = 0;

$i = 1;

// now let's move the file to its final and allocate it with the new filename