我有一个小图片上传脚本,它是一种多图上传的脚本。
这是“提交后”的总数。问题是,上传后,图片的所有字段都是空的。没有一张图片不能在 sql 中看到。可能是什么问题呢?
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$conn = mysql_connect("127.0.0.1","root","");
if(!$conn)
{
echo mysql_error();
}
$db = mysql_select_db("newone",$conn);
if(!$db)
{
echo mysql_error();
}
$aphoto = addslashes(file_get_contents($_FILES['picone']['tmp_name']));
$aphoto = addslashes(file_get_contents($_FILES['pictwo']['tmp_name']));
$aphoto = addslashes(file_get_contents($_FILES['picthree']['tmp_name']));
$aphoto = addslashes(file_get_contents($_FILES['picfour']['tmp_name']));
$image = getimagesize($_FILES['picone']['tmp_name']); //to know about image type etc.
$image = getimagesize($_FILES['pictwo']['tmp_name']);
$image = getimagesize($_FILES['picthree']['tmp_name']);
$image = getimagesize($_FILES['picfour']['tmp_name']);
$q = "INSERT INTO pictures(picone, pictwo, picthree, picfour) Values('$picone','$pictwo','$picthree','$picfour')";
$r = mysql_query($q,$conn);
if($r)
{
header("Location: main.php");
echo "Information stored successfully";
}
else
{
echo mysql_error();
}
?>