我在带有文本输入的表单上有一个图像上传按钮,但设计用于检查、调整大小和上传文件的脚本仅用于一次上传。
有没有办法可以使用带有以下代码的 foreach() 将每个文件提供给该脚本?
if (($_FILES['file']['type'] != 'image/jpeg') && ($_FILES['file']['type'] != 'image/jpg') && ($_FILES['file']['type'] != 'image/pjpeg')) {
echo "<script>alert('Images Must be in jpg format and under 2 Mb');\n";
echo sprintf("window.location='add.php'");
echo "</script>";
include('no-ad-footer.php');
} else {
chdir('admin/photos');
require_once('upload.php');
chdir('../../');
if ($up->ValidateUpload()) {
$node = new sqlNode();
$node->table = "photos";
$node->push("int","TypeID",$_POST['TypeID']);
$node->push("int","ListingID",$ListingID);
$node->push("text","Location",$new_name);
$node->push("int","POrder",$_POST['POrder']);
$node->push("defined","DateofUpload","NOW()");
if(($result = $mysql->insert($node)) === false)
die('Unable to push photo details into table photos line 38');
} else {
echo "<font color='red'>Unable to upload image</font>";
}
}