FTP zip upload is corrupted sometimes

柔情痞子 提交于 2019-11-27 15:42:56

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.

Liudvikas Bukys

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?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!