逗人 我正在制作一个项目,通过拖放dropzone.js插件上传图片。 我想显示上传的图像路径,以便用户可以查看上传的图像。 提前致谢..... 这是我的PHP代码
<?php
session_start();
$image_path = "";
if(!empty($_FILES))
{
$project_id=$_SESSION['id'];
$targetDir = "uploads/";
$fileName = $_FILES['file']['name'];
$targetFile = $targetDir.$fileName;
if(move_uploaded_file($_FILES['file']['tmp_name'],$targetFile)){
//insert file information into db table
$conn->query("INSERT INTO images (project_id,file_name, file_path) VALUES('".$project_id."','".$fileName."','".$targetFile."')");
// echo "path===".$targetFile; exit;
// $image_path = $targetFile;
}
}
?>
<div class="image_upload_div" style="width: 400px;" >
<form action="upload-image.php" class="dropzone" style="height: 400px;">
</form>
</div>
</body>
</html>