我有一个图片上传脚本如下:
$product = $_POST['name'];
$detail = $_POST['detail'];
$price = $_POST['price'];
$class = $_POST['class'];
$category = $_POST['category'];
$name = $_FILES['image']['name'];
$tmpName = $_FILES['image']['tmp_name'];
if ($name) {
//start upload process
$location = "images/" . $name;
move_uploaded_file($tmpName, $location);
}
$query="INSERT INTO shop_products VALUES ('','$product','$location','$detail','$price','$class','$category','yes')";
$result=mysql_query($query) or die(mysql_error());
header("location: ../admin/index.php");
图像的显示如下:
<img class="item-img" src="scripts/images/<? echo $image; ?>" />
如您访问 ltyboards.com/boards 所见,文档源为图像提供了适当的文件名,并且图像确实存在于服务器上,但没有显示任何内容。想法?