我的行包含(id,name,pic),我可以从数据库中删除该行,但无法从文件服务器中删除该图像。
下面的代码应删除图像文件:
if(isset($_GET["delete"])){
$pi=$_GET["delete"];
$qry="delete from item where id=".$_GET["delete"];
$de = mysqli_query($conn,$qry);
$filetmp = $_FILES["pic"]["tmp_name"];
// $filename = $_FILES["pic"]["name"];
$qr ="SELECT id FROM item where id='$pi'";
$res = mysqli_query($conn,$qr);
while($row = mysqli_fetch_array($res)){
$id = $row["id"];
}
$path = "uploads/$id.jpg";
//move_uploaded_file($filetmp,$path);
$fpath = "images_upload/Uitem/$path";
unlink($fpath); // delete file
}
答案 0 :(得分:0)
您必须使用服务器上的路径删除图片,而不是图片网址。 像
https://[third-party-sso-server]/oauth2/authorize?client_id=[my-client-id]&redirect_uri=http://localhost:8080/login&response_type=code&additional_param=[value]