Uploading Multiple Files with RadUpload

Thursday, June 19, 2008 by ASP.NET AJAX Team | Comments 1

Hello Everyone, my name is Rosi and I am a developer on the ASP.NET navigation controls team.

This is my first blog post and I will be talking about the RadUpload component.  Many customers have asked how to upload multiple files with it.

Unfortunately RadUpload does not yet support this functionality out of the box, but I will show you how to work-around this limitation. The trick is uploading one  .zip file and extracting it on the server.  To achieve this we will need a little help from a third party library.  Such libraries are  DotNetZip and SharpZipLib which provide a convenient API to manipulate .zip files.  For the purposes of this blog post I will use DotNetZip.

When the file is uploaded on the server you will need to extract its contents. This is straightforward and can be done like this:

using (ZipFile zip = ZipFile.Read(targetFileName))
{

        foreach (ZipEntry e in zip)
        {
                e.Extract(targetFolder,
true); // overwrite == true
        
}

}

(Here you can find examples illustrating how to use it.)

Once finished you may delete the zip file if you wish. And that’s it – you’re done! The source code for the whole project is available here as a code library. Let me know if you find this blog post useful and feel free to leave a comment.

1 Comments

  • William Seawell 20 Jun
    Great post, Rosi! I was just beginning to use RadUpload and was wondering how to do just this. Thank you thank you thank you!!

Add comment

  1. Formatting options
       
     
     
     
     
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)