Thursday, June 19, 2008
by
ASP.NET AJAX Team
|
Comments
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.