如何从 laravel 8 中的 ftp 磁盘删除文件

how to delete file from ftp disk in laravel 8

我使用 laravel ftp 我可以成功上传文件

$this->path = $this->file->storePublicly( 'chats/' . $this->year . "/" . $this->month , 'ftp');

我尝试使用此代码从 ftp 存储中删除文件,但 none 不起作用

  1. Storage::disk('ftp')->exists('/files/chats/2021/4/VX9FzZ3votNThqEC1lVZKoo0bkY0VbcEyCEdYxFU.jpg')
  2. $ftp = new Ftp([config array]); $ftp->delete('files/chats/2021/4/VX9FzZ3votNThqEC1lVZKoo0bkY0VbcEyCEdYxFU.jpg');

在 #1 方法中,我在 cpanel 错误中看到了这个错误:

2021-04-22 14:12:08.278499 [INFO] [10381] [195.201.169.252:47646:HTTP2-1#APVH_dl.pinpaper.ir:443] Auto Index is disabled for [/home/root/public_html/], access denied。 我将文件权限更改为 0777,我看到“访问被拒绝”错误

在#2 方法中我得到了这个错误ftp_delete(): Could not delete files/chats/2021/4/VX9FzZ3votNThqEC1lVZKoo0bkY0VbcEyCEdYxFU.jpg: No such file or directory

位我检查了 cpanel,我看到了当前目录下的 thw 文件。

当我从路径开头清除文件时,它工作正常。我不知道为什么会这样,只是它的工作。谢谢亲爱的john hanley

files/chats/2021/4/VX9FzZ3votNThqEC1lVZKoo0bkY0VbcEyCEdYxFU.jpg