提取使用ionic.zip dll创建的zip文件时出现问题 [英] issue in extraction of zip file created using ionic.zip dll
本文介绍了提取使用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文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文