Click here to Skip to main content
15,896,456 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have upload and compress large file..how can i split it?
Posted
Comments
shreekar 13-Mar-12 10:44am    
Show some technique/code you have tried and the error you are getting.
Pete O'Hanlon 13-Mar-12 10:59am    
Sorry, but are you asking how you compress and split a file before you upload it, or after it's uploaded? How are you choosing the file?
Sergey Alexandrovich Kryukov 13-Mar-12 21:41pm    
Excuse me, split into what? Right now, the question does not seem to have sense. Can you see "Improve question" above? That could be the way to get some useful advice...
--SA

1 solution

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:

C#
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 ;
}


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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900