Laravel:如何在不下载其他库的情况下通过SFTP传输文件到Azure Blob存储?
我需要能够在Azure Blob存储上的某个目录上传输文件,列表文件和删除文件,并使用现有的Laravel磁盘命令,例如 put> put()
, allfiles(Allfiles()
,<代码> delete()。
以下是我上传文件的代码:
use Storage;
class SFTPFileUploader
{
public function uploadFileToAzure($fileName,$content)
{
$sftpAzureDisk= Storage::disk('sftp');
$sftpAzureDisk->put($fileName,$content);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了能够执行此操作而无需下载其他库,
首先,您需要确保
在设置所有这些之后,在Azure Portal中具有以下设置,您可以继续进行
config> config/filesystems.php
并创建新连接,然后这应该已经可以工作了,而无需下载任何其他库,
PS(我只使用密码进行了测试,而未对密钥文件进行测试)
To be able to do this without having to download other libraries,
First you need make sure you have the following setup in your Azure Portal
After setting all of those, you can proceed to your
config/filesystems.php
and create new connectionthen this should already work without having to download any other library,
P.S (I only have tested working using with Password, not tested yet for Key File)