FTP zip upload is corrupted sometimes

后端 未结 2 734
遥遥无期
遥遥无期 2020-12-03 23:22

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

2条回答
  •  生来不讨喜
    2020-12-04 00:01

    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?

提交回复
热议问题