从数据库中删除文件但未从本地文件夹取消链接警告:文件路径上的权限被拒绝
if(isset($_POST['delete'])){
$checkedCandidates = 0;
$id = implode(",", $_POST['deletecb']);
$checkedCandidates = count($id);
$res=mysqli_query("SELECT file FROM video_gallery where id_vid IN($id) and users_name='$login_session'");
mysqli_fetch_array($res);
#chown(data/58f60f2e09f07_jay/videos, 777);
// here "data/58f60f2e09f07_jay" is file path
unlink("data/58f60f2e09f07_jay/$row[FILE_NAME]");
$query1=mysqli_query($connection,"delete from video_gallery where id_vid IN($id) and users_name='$login_session'");
if($query1)
{
echo "<div id=\"successmsg\"> delete successfully </div>";
}
else
{
echo "<div id=\"errormsg\"> failed operation!!</div>";
}
}
}
答案 0 :(得分:1)
我认为你需要给该文件夹写入权限。它将是777.授予该文件夹的权限,然后尝试取消链接。
要取消链接,Web服务器用户必须具有该目录的写入权限。
答案 1 :(得分:0)
我想你在你的localhost上工作 和您当地的主机文件路径&#34; data / 58f60f2e09f07_jay / videos&#34;许可问题 我认为你需要给该文件夹写入权限