我正在使用Apache的FTPS客户端通过FTPS连接文件并将其放置在服务器上。但是它在storeFile方法上失败了。...
String url = "myTestSTore.com";
String user = "fake";
String password = "reallyFake"
FTPSClient ftpClient = new FTPSClient();
ftpClient.connect(url);
ftpClient.enterLocalPassiveMode()
ftpClient.login(user, password);
def reply = ftpClient.getReplyCode();
println "Reply code after logging in is $reply"
FileInputStream fis = new FileInputStream(randomFile)
def reply2 = ftpClient.getReplyCode();
println "Reply Code before attempting file upload is $reply2"
boolean storeFileResult = ftpClient.storeFile(randomFile.getName(), fis)
def reply3 = ftpClient.getReplyCode();
println "Store file $storeFileResult, reply Code after file upload is $reply3"
输出是...
06 Aug 2018 11:39:30 - Connecting to ftp server: myTestSTore.com
Reply code after logging in is 234
Reply Code before attempting file upload is 230
Store file result is false ,
and reply Code after file upload is 522
根据回复代码,看来我们能够连接并登录。但是storeFile方法返回false,之后的回复代码为500。
有什么办法可以说明为什么文件上传失败?
仅返回false并给出500,就无法说明上传失败的原因。