Zip file Download problem..
-
Hello Genious.. I have some word files on server.. that i need to download all of them together.. So i have only one option that first i create a zip file from all these files and then then download this zip file.. So my functionality achived. But when i extract these zip file and opens word any of word files within downloaded zip file, Opened Word file shows only byte data means some thing like lots of Sqaures which may be same as bytes of files.. and obeviously word file should display actual content in readable character.. Any Suggestons will appreciated... If needed the please refer to my code.. For i As Integer = 0 To strFileToDownload.Count - 1 Dim strFileName As String = Path.GetFileName(strFileToDownload(i)) Dim MyFileStream As FileStream = File.OpenRead(strFileToDownload(i)) Dim buff() As Byte = New Byte((MyFileStream.Length)) {} 'Dim zipEntry As New ZipEntry(strFileToDownload(i)) Dim zipEntry As New ZipEntry(strFileName) zipOS.PutNextEntry(zipEntry) zipOS.Write(buff, 0, buff.Length) zipOS.InitializeLifetimeService() MyFileStream.Close() Next ' Compress and close the zip file zipOS.Finish() zipOS.Close() Response.ClearContent() Response.ClearHeaders() Response.ContentType = "application/zip" Response.AddHeader("Content-Disposition", "attachment; filename=" + "CMM " + strProjectSize + " size Project Documents" + System.IO.Path.GetFileName(strNow)) Response.WriteFile(strNow) Response.Flush() Response.Clear()