MVC_DotNetZip如何在ASP.Net项目中使用-创新互联
这篇文章给大家介绍MVC_DotNetZip如何在ASP.Net项目中使用,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
准备工作:
在vs工具栏中找到NuGet
下载DotNetZip
现在就可以使用DotNetZip强大的类库了,在这里我给出一些简单的使用。
public ActionResult Export() { using (ZipFile zip = new ZipFile(System.Text.Encoding.Default)) { zip.AddFile(Server.MapPath("~/Img/2.png"), "Images"); zip.AddFile(Server.MapPath("~/File/1.pdf"), "Files"); zip.Save(Server.MapPath("~/ZIP/Test.zip")); return File(Server.MapPath("~/ZIP/Test.zip"), "application/zip", "sample.zip"); } }
当前标题:MVC_DotNetZip如何在ASP.Net项目中使用-创新互联
网页地址:http://tyjierui.cn/article/pcihc.html