I've got a zip file which work fine on my local file system. After I upload it to a FTP server, the file gets corrupted. It seems something gets appended to the file because the zip file is bigger after I've uploaded it.
When I try to unzip it after I've uploaded it says: error: invalid compressed data to inflate --> 77 extra bytes at beginning or within zipfile
I'm using the Jacarta Jacarta Commons Net FTP package to deal with the FTP server.
I can't figure this one out. Why does my code append data to the file when uploading it to the FTP?
Why does my code append data to the file when uploading it to the FTP?
Because you are telling it to. This code:
always writes 8192 bytes to the output stream no matter how many bytes were read. You need to find out how many bytes were read in and only write that many out. Have a look at this example and let us know if it works or if you have any other questions.