今天做了一个异步上传文件后再直接解压的一个东西。到解压这找了好多资料,做了1个多小时,贴出来,给自己张张记性。

 HttpPostedFileBase imgFile = Request.Files[0];//获取到文件流
filename = imgFile.FileName;
imgFile.SaveAs(Server.MapPath("../Test/" + filename));//保存到本地
var archive = ArchiveFactory.Open(Server.MapPath("../Test/" + filename));//通过Server.MapPath找到文件的绝对路径
foreach (var entry in archive.Entries)
{
if (!entry.IsDirectory)//开始解压
{
entry.WriteToDirectory(Server.MapPath("../Test/"), ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);//解压地址也是要绝对路径的
}
}

  然后要补充的是需要引用一个dll 叫SharpCompress.dll 下载地址:http://sharpcompress.codeplex.com/#

最新文章

  1. x01.os.14: 时间都去哪儿了
  2. git如何放弃所有本地修改?
  3. Spring与Quartz的整合实现定时任务调度(转)
  4. hdu 2509 博弈 *
  5. Oracle子查询(嵌套查询)
  6. 让所有浏览器包括IE6即支持最大宽度又支持最小宽度。
  7. C语言中字符数组和字符串指针分析
  8. Jquery Ajax方法传递json到action
  9. ul li 好友列表
  10. SQL点滴15—在SQL Server 2008中调用C#程序
  11. 推荐xamlspy
  12. 完美实现身份证校验 js正则
  13. 控件之combox
  14. spring中基于注解使用AOP
  15. Ubantu linux中使用PyCharm之---破解PyCharm,实现永久免费试用
  16. LoadRunner之IP欺骗
  17. LINQ(数据库操作增、删、改及并发管理)
  18. JavaScript和它父亲的故事
  19. 【xsy1130】tree 树形dp+期望dp
  20. [BeiJing2006]狼抓兔子

热门文章

  1. iOS开发零碎知识点
  2. 通过GitHub Pages建立个人站点总结与体会
  3. eaysui 利用datagrid 实现左右移除数据
  4. What technical details should a programmer of a web application consider before making the site public?
  5. C扩展python的module和Type
  6. java递归应用
  7. shell 从1加到100
  8. 一个简单的loading,纯属自娱自乐
  9. Download Oracle Forms 6i
  10. oracle,mysql,SqlServer三种数据库的分页查询的实例。