[英]Upload file using java in ftp
I want to upload file from my system to remote server as ftp.how i am to resolve this.I am using FTPClient client = new FTPClient(); and client.connect("sftp://something.com");
我想将文件从系统作为ftp上传到远程服务器。如何解决此问题。我正在使用
FTPClient client = new FTPClient(); and client.connect("sftp://something.com");
FTPClient client = new FTPClient(); and client.connect("sftp://something.com");
But i am unable to connect it how i am check weather problem with my code or url.like ping command 但是我无法连接它如何用我的代码或url.like ping命令检查天气问题
I haven't used FTPClient
(assume you mean Apache Commons FTPClient but a quick browse of apidocs shows two errors in your use: 我尚未使用
FTPClient
(假设您的意思是Apache Commons FTPClient,但是对apidocs的快速浏览显示了您使用中的两个错误:
client.connect("sftp://something.com")
should be client.connect("something.com")
client.connect("sftp://something.com")
应该是client.connect("something.com")
If you're connecting to an Sftp you might need to add the appropriate certificates (public/private keys) to the JVM where the code is running. 如果要连接到Sftp,则可能需要向运行代码的JVM添加适当的证书(公共/专用密钥)。 Try your code on a regular FTP connection first, if that works, but not the sftp connections, it's almost sure is because of that.
首先尝试在常规FTP连接上运行您的代码(如果可以),但不能在sftp连接上运行,几乎可以肯定是因为这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.