I use the following code for a zip file and it works fine, but when I unpack using WinRar, I get the original file name without extension, any key, why if the file name is myReport.xls
, when I unpack, I get only myReport
using (var fs = new FileStream(fileName, FileMode.Open)) { byte[] input = new byte[fs.Length]; fs.Read(input, 0, input.Length); fs.Close(); using (var fsOutput = new FileStream(zipName, FileMode.Create, FileAccess.Write)) using(var zip = new GZipStream(fsOutput, CompressionMode.Compress)) { zip.Write(input, 0, input.Length); zip.Close(); fsOutput.Close(); } }
source share