We are using ZipOutputStream for downloading a zip file. I am having problems in opening this zip file in winzip 9.0 but the same file opens fine in winzip 8.0.
But when i write the same file using FileOutputStream and ZipOutputStream into the server that file opens fine in Winzip 9.0.
The error I am getting is "Start of central directory not found:zip file corrupt.
Possible cause: File transfer error"
When i try to fix the problem using the Winzip command line Add-On
It fixes the problem by saying the file has "extra 12 bytes at beginning of the file"
What could be the reason for having this extra 12 bytes only when i do a download but not when i write it into a file?
Please help me if you have any information on this
Post by:Greg Charles
Hi landyn, welcome to Java Ranch!
It seems like I had this "12 byte" problem at some point, but I can't remember how I resolved it. All I can find is that an encrypted zip file generally starts with a 12-byte encryption header, so maybe that has something to do with it. Can you tell what those 12 bytes are? Also, is there some reason you're using WinZip 9.0? I see that the latest version is 20. It's possible a newer version would fix your problem.
Post by:braden russell
All what you need is to follow next instructions, and via Windows instrument you may do it...
- Click on the "Start" button, click on "All Programs" and then go into "Accessories."
- Right-click on the "Command Prompt" program and select "Run as administrator."
- Type "cd directory_path_to_zip" where "directory_path_to_zip" is the fully qualified path to the corrupted zip file, such as "C:\Windows\" if your ZIP file is located in the Windows directory on your computer.
- Press the "Enter" key and then type "c:\windows\system32\wzzip -yf corrupt_zip.zip" where "corrupt_zip.zip" is the name of the ZIP file you want to try and recover.
- Press the "Enter" key and Windows attempts to fix the corrupt ZIP file. If this process is successful, a new ZIP file is created in the directory alongside the corrupt zip file with the same name as the corrupt zip file, only with the suffix "FIXED" on the end.
Please do the following to attempt to repair a Zip file or you may apply following topics in case your .zip archive is hardly corrupted:
Zip Repair Toolbox https://www.repairtoolbox.com/ziprepair.html - if you like fast and not free solutions
Post by:Campbell Ritchie
Welcome to the Ranch and thank you for the helpful instructions.