My java program uploads a zip file from my system to an FTP server. uploadfile()is a function containing the download code.
uploadfile ("192.168.0.210", "muruganp", "vm4snk", "/ home / Admin / GATE521 / LN_RB_Semivalid2junk / exit /" + date + "_ RB1.zip", "/ file_server / filesbackup / EMÀC /" + date + "_ RB1.zip");
public static boolean uploadfile(String server, String username,
String Password, String source_file_path, String dest_dir) {
FTPClient ftp = new FTPClient();
try {
int reply;
ftp.connect(server);
ftp.login(username, Password);
System.out.println("Connected to " + server + ".");
System.out.print(ftp.getReplyString());
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
System.err.println("FTP server refused connection.");
return false;
}
System.out.println("FTP server connected.");
InputStream input = new FileInputStream(source_file_path);
ftp.storeFile(dest_dir, input);
System.out.println(ftp.getReplyString());
input.close();
ftp.logout();
} catch (Exception e) {
System.out.println("err");
e.printStackTrace();
return false;
} finally {
if (ftp.isConnected()) {
try {
ftp.disconnect();
} catch (Exception ioe) {}
}
}
return true;
}
The mail file I have on my system is perfect. But after you downloaded it on the server, download it and remove the problem. “The file is corrupt,” the error says. What should I do to solve this problem. Please report this.
, - ASCII. QUESTION. ? .