I just had it working, then I thought I was done and it stopped working. if the file is not an image, I’m trying to get it to kick out an error. here is the piece im talking about. any help would be gladly appreciated
$type_array = array('image/jpeg', 'image/gif', 'image/png','image/x-png'); //image types allowed
if(isset($_FILES['images'][$i]) and $_FILES['images']['name'][$i] != '') { //check image
if ($_FILES['images']['size'][$i] < 10240000) { //make sure file is larger than 10mb
$type = $_FILES['images']['type'][$i]; //get the file types
if (!in_array($type, $type_array)) { //make sure the images are allowed
$errors[] = "Please check that you are uploading an image.";
$show_errors = 'show';
exit;
}
} else {
$errors[] = "Please make sure each file is less than 10MB.";
$show_errors = 'show';
exit;
}
} //image checked
This are the errors
A.
$_FILES ['images'] ['size'] [$i]would only work if you are expecting multiple image uploadSolution
You should just use
$_FILES ['images'] ['size']B. The Follow Script is wrong
Just use
If you are dealing with multiple images .. have give to many examples here before see .
limiting the checking condition while uploading swf files
PHP – Saving Uploaded Image to Server