Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in Windows Azure when uploading a zip file: "ZipException was unhandled" "EOF in header"

I've been using Windows Azure to create a document management system, and things have gone well so far. I've been able to upload and download files to the BLOB storage through an asp.net front end.

What I'm attempting to do now is allow users to upload a .zip file, and then take the files out of that .zip and save them as individual files. Problem is, I'm getting "ZipException was unhandled" "EOF in header" and I don't know why.

I'm using the ICSharpCode.SharpZipLib library which I've used for many other tasks and its worked great.

Here's the basic code:

CloudBlob ZipFile = container.GetBlobReference(blobURI);
MemoryStream MemStream = new MemoryStream();
ZipFile.DownloadToStream(MemStream);
....
while ((theEntry = zipInput.GetNextEntry()) != null)

and it's on the line that starts with while that I get the error. I added a sleep duration of 10 seconds just to make sure enough time had gone by.

MemStream has a length if I debug it, but the zipInput does sometimes, but not always. It always fails.

like image 626
david Avatar asked Feb 02 '26 04:02

david


1 Answers

Just a random guess, but do you need to seek the stream back to 0 before you read it? Not sure if you're doing that already (or if it's necessary).

like image 147
user94559 Avatar answered Feb 03 '26 23:02

user94559