我已经上传了图像并将其存储在“应用程序/照片”路径中,但是以某种方式我无法检索它。
<?php
$app = $_POST['app'];
$dbLink = mysqli_connect('localhost','root','','another');
$sql = "SELECT * FROM lama WHERE app = '$app'";
$sth = mysqli_query($dbLink,$sql);
while($row=mysqli_fetch_array($sth)) {?>
<img src="Application/Photo/ <?php echo $row['photoname']; ?>" height="250px" width="190px"/>
<?php
}
?>
//Below is the code I used to upload the image
$puploads_dir = 'Application/Photo';
$pname = $_FILES["photo"]["name"];
$tname=$_FILES["photo"]["tmp_name"];
$photoname = pathinfo($_FILES['photo']['name'], PATHINFO_FILENAME);
$extensionp = pathinfo($_FILES['photo']['name'], PATHINFO_EXTENSION);
$incrementp = 0;
$pname = $photoname . '.' . $extensionp;
while(is_file($puploads_dir.'/'.$pname)) {
$incrementp++;
$pname = $photoname . $incrementp . '.' . $extensionp;
}
move_uploaded_file($tname, $puploads_dir.'/'.$pname);
$query = "
INSERT INTO `lama` (
`photoname` )
VALUES (
'{$pname}')";
我还上传了用于上传图片的代码。