Problem with unzip
-
hi all I read article http://www.codeproject.com/KB/cs/Zip_UnZip.aspx[^] But I have problem when i run function unzip My file zip containt six file and two folder and in there folder containt some file When i run Fuction < code> public void UnZip(string SrcFile, string DstDir) { FileStream fileStreamIn = new FileStream(SrcFile, FileMode.Open, FileAccess.Read); ZipInputStream zipInStream = new ZipInputStream(fileStreamIn); ZipEntry entry; int size; byte[] buffer = new byte[BUFFERSIZE]; while ((entry = zipInStream.GetNextEntry()) != null) { FileStream fileStreamOut = new FileStream(DstDir + @"\" + entry.Name, FileMode.Create, FileAccess.Write); while((size = zipInStream.Read(buffer, 0, buffer.Length)) > 0) { fileStreamOut.Write(buffer, 0, size); } fileStreamOut.Close(); } zipInStream.Close(); fileStreamIn.Close(); } < /code> But have exception when it unzip to folder name "folderdemo". System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Inetpub\wwwroot\DacNong\Atlas\Data\folderdemo\'. Some body help me. How could i unzip when in file zip contain file and folder ???
-
hi all I read article http://www.codeproject.com/KB/cs/Zip_UnZip.aspx[^] But I have problem when i run function unzip My file zip containt six file and two folder and in there folder containt some file When i run Fuction < code> public void UnZip(string SrcFile, string DstDir) { FileStream fileStreamIn = new FileStream(SrcFile, FileMode.Open, FileAccess.Read); ZipInputStream zipInStream = new ZipInputStream(fileStreamIn); ZipEntry entry; int size; byte[] buffer = new byte[BUFFERSIZE]; while ((entry = zipInStream.GetNextEntry()) != null) { FileStream fileStreamOut = new FileStream(DstDir + @"\" + entry.Name, FileMode.Create, FileAccess.Write); while((size = zipInStream.Read(buffer, 0, buffer.Length)) > 0) { fileStreamOut.Write(buffer, 0, size); } fileStreamOut.Close(); } zipInStream.Close(); fileStreamIn.Close(); } < /code> But have exception when it unzip to folder name "folderdemo". System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Inetpub\wwwroot\DacNong\Atlas\Data\folderdemo\'. Some body help me. How could i unzip when in file zip contain file and folder ???
DEAR I USED VSJLIB FOR UNZIPPING THE FILE. USING THIS REFRENCE UNZIPPING IS VERY EASY. DO TRY OUT THIS
Hello Forum Always be in touch to help about the topic ASP.NET