在localhost / windows上的PHP unlink被拒绝 [英] PHP unlink denied on localhost / windows

查看:1056
本文介绍了在localhost / windows上的PHP unlink被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在葡萄牙语中,我们使用一个表达式来告诉发生了什么:


所以,我试图取消链接一个图像,而在写这个主题时,我正在考虑< ; img src ='url'/> 表示图像已打开(?)。



我有一个带有两列的html表。

 #|图像
删除此处显示的图像
删除此处显示的图像
等..等...

点击删除,执行一个AJAX函数。

  $(。delete) .on('click',function(){
var parent = $(this).parent();
$ .ajax({
url:'inc / response.php?type = deleteImage',
data:{id:$(this).attr('id')},
type:'POST',
success:function(data){
parent.remove();
}
});
});

deleteImage 的代码是以下:

  $ path =../images/videos/。 $图像 - >获得($ _ REQUEST [ ID]); 

这个完美地返回路径。

  unlink($ path); 

如果路径不正确,php日志返回:


由于文件或目录不存在,取消链接时出错..


我得到的是


PHP警告:



unlink(../图像/视频/):
中的权限被拒绝C:\xampp\htdocs\\\
ewproject\inc\response.php


由于我在本地工作,而且是Windows,我为该文件夹设置了正确的管理权限。
Btw,该文件夹具有以下结构:

 图像
>视频
> customer_A
> customer_B
> customer_C



总控制标志为每个用户设置。



那么我做错了什么?问题可能是因为图像在< img src> 中的打开?

解决方案

您正在尝试删除 ../ images / videos / 目录。看来你的 $ image-> get($ _ REQUEST ['id'])返回空。


In portuguese language we use an expression to tell what's going on which is:

this is witchcraft

So, I'm trying to unlink an image, and while I'm writing this topic I'm thinking about the possibility of <img src='url'/> means that the image is open (?).

I have an html table with two columns.

#        |     Image
Delete      Image here displayed
Delete      Image here displayed
etc..       etc...

By clicking "Delete", an AJAX function is performed.

$(".delete").on('click', function(){
    var parent = $(this).parent();
    $.ajax({
        url: 'inc/response.php?type=deleteImage',
        data: {id: $(this).attr('id')},
        type: 'POST',
        success: function(data){
            parent.remove();
        }
    });
});

And the code for deleteImage is the following:

$path = "../images/videos/" . $image->get($_REQUEST['id']);

This returns perfectly the path.

unlink($path);

If the path is incorrect the php log returns:

Error on unlink because file or directory does not exists..

, but the message I'm getting is

PHP Warning:

unlink(../images/videos/): Permission denied in C:\xampp\htdocs\newproject\inc\response.php

Since I'm working locally and it's windows, I've set the right administration rights for the folder. Btw, the folder has the following structure:

images 
   > Videos
         > customer_A
         > customer_B
         > customer_C

The Total Control flag is set for EVERY user.

So, what am I doing wrong? Can the problem be because of the image is "open" in the <img src> ?

解决方案

You are trying to remove ../images/videos/ directory. It seems your $image->get($_REQUEST['id']) returns empty.

这篇关于在localhost / windows上的PHP unlink被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆