简体   繁体   中英

phpseclib SFTP can`t put file with special characters

Following code is used to upload file to SFTP:

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

It uses phpseclib/phpseclib/Net/SFTP.php behind the scenes. Upload does not work when trying to upload file with special characters in it eg "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?

idk if Laravel creates a wrapper around phpseclib's put but, with phpseclib, your put($localFile, $remotePath) call would be wrong. 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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