I am doing a form that upload multiple images, how do I code such that files that are only 'jpg', 'png', 'gif' will be uploaded successfully and will skip those unacceptable files (eg. doc)? Currently my codes only allow upload if all files are accepted types and will prompt error even if there's only one file that is not acceptable file type
if ($source_type === NULL) {
echo '<h3>Error</h3><br/>';
echo 'Invalid file type<br/><br/>';
echo '<input type="submit" style="color:#000000" onClick="history.go(-1);return true;" value="Back"><br/><br/>';
}
switch ($source_type) {
case IMAGETYPE_GIF:
$source_gd_image = imagecreatefromgif($source_file_path);
break;
case IMAGETYPE_JPEG:
$source_gd_image = imagecreatefromjpeg($source_file_path);
break;
case IMAGETYPE_PNG:
$source_gd_image = imagecreatefrompng($source_file_path);
break;
default:
return false;
}