如何在asp.net中分割压缩文件? [英] How to Split compressed file in asp.net?
本文介绍了如何在asp.net中分割压缩文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经上传并压缩了大文件.如何分割它?
i have upload and compress large file..how can i split it?
推荐答案
CodePlex DotNetZip ^ ]是易于使用的FAST,免费类库和工具集,可用于使用.NET框架进行压缩和拆分.这是示例代码:
CodePlex DotNetZip http://dotnetzip.codeplex.com/[^] is an easy-to-use, FAST, FREE class library and toolset for manipulating compression and split using .NET framework. Here is the sample code:
int SegmentsCreated ;
using (ZipFile zip = new ZipFile())
{
zip.UseUnicode= true; // utf-8
zip.AddDirectory(@"MyDocuments\ProjectX");
zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G") ;
zip.MaxOutputSegmentSize = 100*1024 ; // 100k segments
zip.Save("MyFiles.zip");
SegmentsCreated = zip.NumberOfSegmentsForMostRecentSave ;
}
如果SegmentsCreated返回为5,则您具有以下文件,每个文件的大小不超过100kb.
•MyFiles.zip
•MyFiles.z01
•MyFiles.z02
•MyFiles.z03
•MyFiles.z04
if SegmentsCreated comes back as 5, then you have the following files, each not more than 100kb in size.
•MyFiles.zip
•MyFiles.z01
•MyFiles.z02
•MyFiles.z03
•MyFiles.z04
这篇关于如何在asp.net中分割压缩文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文