【发布时间】:2018-03-14 06:05:48
【问题描述】:
我正在尝试一次上传多张图片,这是我目前所拥有的:
if(isset($_POST['submit']))
{
$file_name=$_FILES["image"]["name"];
foreach($file_name as $files)
{
$target_path = "Sub_uploads/".$files;
if(move_uploaded_file($files["image"]["tmp_name"],$target_path))
{
$target_path="Sub_uploads/".$files;
$sql = "INSERT INTO product_images (image) VALUES ('$target_path')";
$query = mysql_query($sql);
}
}
echo "<script>alert('data inserted');document.location='Sub_CateGory_image.php'</script>";
}
?>
似乎是在这一行出现错误:if(move_uploaded_file($files["image"]["tmp_name"],$target_path))
【问题讨论】:
-
请说明报告的错误。
-
只需将 $_FILES["image"]["tmp_name"] 替换为 $files["image"]["tmp_name"]
-
我试试这个,但它不起作用..
标签: php image file-upload image-uploading