为超过1 GB的文件生成ZIP [英] Generate ZIP for more than 1 GB file

查看:78
本文介绍了为超过1 GB的文件生成ZIP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我使用Ionic.Zip从C#生成拉链.net

工作正常,最高可达1GB。



但是当我想压缩文件> 1GB,它给予



算术运算中的溢出或下溢错误在下面的zip.save声明附近。



这里是我的代码片段:



foreach(ListItem li in cblFiles.Items)

if(li.Selected)

{



//记录readMeMessage中包含的文件

readMeMessage + = string.Concat( \t *,li.Text,Environment.NewLine);



//现在将文件添加到ZIP中(使用值作为将文件放在root文件夹中的第二个参数)



zip.AddFile(li.Value,Your Files);

}







//将ZIP的内容发送回输出流

zip.Save(Response.OutputStream);



请帮我解决这个问题,或者提供任何替代链接。

解决方案

还有很多其他的开源解决方案,例如#ziplib,7-Zip和SharpCompress。请通过链接查看我过去的答案:

如何在c#中使用相同的文件名在zip文件夹中添加文件名 [ ^ ],

< a href =http://www.codeproject.com/Answers/575774/Extractplusfileplusrarpluswithplusvb-net#answer1>使用vb.net提取文件rar [ ^ ],

两个文件夹之间的比较 [ ^ ]。



-SA

Hi,

I am using Ionic.Zip to generate zip from C#.net
its working fine upto 1GB.

But When I want to zip the files > 1GB, its giving

"Overflow or Underflow in Arithmetic Operation" error near the "zip.save" statement below.

here is my code snippet:

foreach (ListItem li in cblFiles.Items)
if (li.Selected)
{

// Record the file that was included in readMeMessage
readMeMessage += string.Concat("\t* ", li.Text, Environment.NewLine);

// Now add the file to the ZIP (use a value of "" as the second parameter to put the files in the "root" folder)

zip.AddFile(li.Value, "Your Files");
}



// Send the contents of the ZIP back to the output stream
zip.Save(Response.OutputStream);

please help me to solve this issue, or provide me any alternative link.

解决方案

There is a number of other open-source solutions, such as #ziplib, 7-Zip and SharpCompress. Please see my past answers with links:
how to add file name in zip folder with same file name in c#[^],
Extract file rar with vb.net[^],
Compare between two folders[^].

—SA


这篇关于为超过1 GB的文件生成ZIP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆