doubiao7410 2016-11-14 20:24
浏览 43

取消链接不与文件夹名称路径中的句点(.dot)一起使用

Problem:

unlink() is not working with a period . in the foldername path. It works without a period in the path though.

What I have tried:

I tried the escaping method. no luck.

$imagetodelete = $_GET['imagetodelete'];
$delete = $_GET['delete'];

if ($delete == "yes") {
error_reporting(E_ALL); #ini_set('display_errors', 1);



$dir = ('/var/www/example.com/pictures.gif.collection/');

directory

$dir = str_replace(".", "\\.", $dir);

and

$dir = str_replace(".", "\.", $dir);

I combined them into $filepath

 $filepath = "/www/example.com/pictures.gif.collection/$imagetodelete";
 unlink($filepath);
}

errors are Permission denied (if directory name has dots makes no sense) php script, file to delete, and folder are all set to 777

the above only works if
$filepath = "/www/example.com/picturesgifcollection/image.jpg"; (no dots)

I also tried:
unlink not working with space in foldername path

  • 写回答

1条回答 默认 最新

  • dousha1873 2016-11-15 06:08
    关注

    i posted this before, the answer was permissions.. i set it to full root and it worked

    thanks to Dragon genius

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序