我需要在表单上上传25张图片,图片名称是1到25,因此是数组。 它接缝成功上传所有图像到9号,然后当它上传10号时,它只显示一个空白的白页并停止。
这是数组和php上传:
$imageuploadarray = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25);
foreach($imageuploadarray as $imagenumber) {
if(empty($_FILES["image$imagenumber"])) {
//$imagemessagebad = 'Error!';
} else {
$fileName = $imagenumber.'.jpg';
$fileTmpLoc = $_FILES["image$imagenumber"]["tmp_name"];
$fileType = $_FILES["image$imagenumber"]["type"];
$fileSize = $_FILES["image$imagenumber"]["size"];
$fileErrorMsg = $_FILES["image$imagenumber"]["error"];
$kaboom = explode(".", $fileName); // Split file name into an array using the dot
$fileExt = end($kaboom); // Now target the last array element to get the file extension
if(!$fileTmpLoc) {
$imagemessagebad = 'Error - Please Select An Image!';
exit();
} elseif(!preg_match("/.(jpg)$/i", $fileName) ) {
$imagemessagebad = 'Error - Wrong Image Type!';
unlink($fileTmpLoc);
exit();
} elseif($fileErrorMsg == 1) {
$imagemessagebad = 'Error Processing Image!';
exit();
}
$moveResult = move_uploaded_file($fileTmpLoc, "/xampp/htdocs/techbite/articles/reviews/reviews/$catagoryprocess/$titleprocess/big/$fileName");
if($moveResult != true) {
$imagemessagebad = 'Error Uploading Image!';
unlink($fileTmpLoc);
exit();
} else {
//unlink($fileTmpLoc);
}
if($fileErrorMsg == 0) {
$thumbnailmessagegood = 'The image '.$fileName.' has been uploaded!';
} else {
$thumbnailmessagebad = 'Error Uploading Image!';
}
}
}
正如我所说,它适用于单张图像和多张图像。但是一旦它达到10号就会显示一个白色的空白页并停止。