Я пытаюсь загрузить один большой файл (более 8 МБ) с использованием метода storeFile (удаленного, локального) FTPClient, но это приводит к ложному результату. Он загружается с некоторыми дополнительными байтами.*
public class Main {
public static void main(String[] args) {
FTPClient client = new FTPClient();
FileInputStream fis = null;
try {
client.connect("208.106.181.143");
client.setFileTransferMode(client.BINARY_FILE_TYPE);
client.login("abc", "java");
int reply = client.getReplyCode();
System.out.println("Received Reply from FTP Connection:" + reply);
if(FTPReply.isPositiveCompletion(reply)){
System.out.println("Connected Success");
}
client.changeWorkingDirectory("/"+"Everbest"+"/");
client.makeDirectory("ETPSupplyChain5.3-EvbstSP3");
client.changeWorkingDirectory("/"+"Everbest"+"/"+"ETPSupplyChain5.3-EvbstSP3"+"/");
FTPFile[] names = client.listFiles();
String filename = "E:\\Nitin\\D-Drive\\Installer.rar";
fis = new FileInputStream(filename);
boolean result = client.storeFile("Installer.rar", fis);
int replyAfterupload = client.getReplyCode();
System.out.println("Received Reply from FTP Connection replyAfterupload:" + replyAfterupload);
System.out.println("result:"+result);
for (FTPFile name : names) {
System.out.println("Name = " + name);
}
client.logout();
fis.close();
client.disconnect();
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
o/p:
Received Reply from FTP Connection:230
Connected Success
32 /Everbest/ETPSupplyChain5.3-EvbstSP3
Received Reply from FTP Connection replyAfterupload:150
result:false