本文介绍了提取使用ionic.zip dll创建的zip文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好, 我正在面对我的zip文件的问题,当我尝试从zipped文件夹打开文件然后它没有打开,但当我尝试打开文件后解压缩文件夹然后打开,它工作正常,请帮我解决问题,这里是我用来拉链Ionic.Zip dll的功能
Hi all, I am facing the issue with my zip file ,when i try to open the file from zipped folder then it does not open ,but when i try to open file after extract the folder and then open ,it works fine ,please help me to resolve the issue,here is the function that i am using to zip with Ionic.Zip dll
private void ExportToZip() { Response.Clear(); //Response.BufferOutput = false; Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "filename=\"PnLBudgetExport.zip\""); using (ZipFile zip = new ZipFile()) { if (Directory.Exists(Server.MapPath(ZIP_FOLDER))) { foreach (string file in Directory.GetFiles(Server.MapPath(ZIP_FOLDER))) { zip.CompressionMethod = CompressionMethod.None; //int indx = file.LastIndexOf("\\"); //zip.AddEntry(file.Substring(indx), File.ReadAllBytes(file)); zip.AddFile(file, string.Empty); } } zip.Save(Response.OutputStream); } DeleteTempDir(); } where ZIP_FOLDER ="~/ZipExport"请帮帮我,谢谢提前。
Please help me ,Thanks in advance.
推荐答案据我所知,您无法访问压缩存档中的(打开)文件。你需要先提取它。 As far as i know, you can't access(open) file in the zipped archive. You need to extract it before.
更多推荐
提取使用ionic.zip dll创建的zip文件时出现问题
发布评论