简体   繁体   English

phpseclib SFTP 不能放置带有特殊字符的文件

[英]phpseclib SFTP can`t put file with special characters

Following code is used to upload file to SFTP:以下代码用于将文件上传到 SFTP:

\SSH::into('server')->put($localFile, $remotePath);

It uses phpseclib/phpseclib/Net/SFTP.php behind the scenes.它在幕后使用phpseclib/phpseclib/Net/SFTP.php Upload does not work when trying to upload file with special characters in it eg "file_ü_e.jpg"尝试上传包含特殊字符的文件时,上传不起作用,例如"file_ü_e.jpg"

Uploading such file via GUI tool to given server works so the question - is it possible and what should be done to upload it via script?通过 GUI 工具将此类文件上传到给定的服务器有效,因此问题是 - 是否有可能以及应该如何通过脚本上传它?

idk if Laravel creates a wrapper around phpseclib's put but, with phpseclib, your put($localFile, $remotePath) call would be wrong. idk 如果 Laravel 围绕 phpseclib 的 put 创建一个包装器,但是使用 phpseclib,你的put($localFile, $remotePath)调用将是错误的。 With phpseclib if you want to upload a file on the local filesystem to a remote SFTP server you'd need to do something like this:使用 phpseclib 如果要将本地文件系统上的文件上传到远程 SFTP 服务器,则需要执行以下操作:

->put($remotePath, $localFile, NET_SFTP_LOCAL_FILE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM