I wrote a code for saving few images in a file and later compressing that file and uploading to an ftp server. When I download that from server, few files are fine and few f
Be sure to transfer files in BINARY_FILE_TYPE. Maybe ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
returns false?
By the way, if you transfer a zip in ASCII-mode, this will almost surely result corrupted.
See also Is java.io.BufferedOutputStream safe to use? which shows how out.close()
might hide an IOException. Solution is to do an explicit out.flush()
before out.close
.
Also, whatever is retrieving the file from your FTP server, is that also using BINARY mode to retrieve?