Click here to Skip to main content
15,891,204 members

Comments by Parveen Siwach (Top 8 by date)

Parveen Siwach 4-Aug-16 2:24am View    
I tried this and is working fine. Can you share the Zip file that you want to unzip?

protected void btnUnzip_Click(object sender, EventArgs e)
{
StringBuilder newPath = new StringBuilder();
newPath.Append(@"D:\Test\");
string zipPathAndFile = @"D:\Data\User_Data.zip";
ZipInputStream zipIn = new ZipInputStream(File.OpenRead(zipPathAndFile));
DecompressArchive(newPath, zipIn);
}

public static void DecompressArchive(StringBuilder newPath, ZipInputStream zipIn)
{
ZipEntry entry;
while ((entry = zipIn.GetNextEntry()) != null)
{
if (entry.Name.EndsWith("/"))
{
Directory.CreateDirectory(String.Format("{0}{1}", newPath, entry.Name.Replace(@"/", @"\")));
}
else
{
FileStream streamWriter = File.Create(String.Format("{0}{1}", newPath, entry.Name.Replace(@"/", @"\")));
long size = entry.Size;
Byte[] data = new Byte[size];
while (true)
{
size = zipIn.Read(data, 0, data.Length);
if (size > 0) streamWriter.Write(data, 0, (int)size);
else break;
}
streamWriter.Close();
}
}
}
Parveen Siwach 26-Jul-16 16:13pm View    
You have done some sort of hard coding
scannerDevice.Items[1]

What is the output of the following statement
scannerDevice.Items.Count
Parveen Siwach 26-Jul-16 0:43am View    
check that fuDocumentk.PostedFile.InputStream has value
or
check fuDocumentk.PostedFile.InputStream.Length > 0

I think code has no problem, but the problem is with data.
Parveen Siwach 11-Mar-16 7:54am View    
share more details about this issue?
Parveen Siwach 11-Mar-16 7:53am View    
Ok