1

我有一个图片上传脚本如下:

$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 所见,文档源为图像提供了适当的文件名,并且图像确实存在于服务器上,但没有显示任何内容。想法?

4

1 回答 1

2

看起来你的路径是错误的

scripts/images/images/

应该

scripts/images/

于 2012-05-31T15:04:10.447 回答