michielpost.nl

Upload files with Silverlight using HttpHandler

08-12-2008

WCF
The Silverlight Multi File Upload control was originally made using WCF webservies. Each file was uploaded in multiple small chunks. This results in a lot of small chuncks, and a lot of requests to the webserver.

HttpHandler
An alternative way of uploading is using a HttpHandler to receive the file in big chunks of 4MB. The result is less overhead and a faster upload experience.

The Silverlight Mulit File Uploader now supports uploading using a HttpHandler. The HttpHandler is included in the project (HttpUploadHandler.ashx). To use it, add the following initParameter: HttpUploader=true
Example usage is shown on this page in the project: HttpUploader_SilverlightMultiFileUploadTestPage.aspx)

PHP
Another advantage of the HttpHandler option is that it's easier to write a PHP version of the handler. The included HttpHandler is written in C#.

Example
Download changeset 8572 or later on CodePlex and see the included testpage (HttpUploader_SilverlightMultiFileUploadTestPage.aspx)

You can see the control in action here.

Comments


stone7666 05-01-2009
Thanks a lot.I am a beginer of learning Silverlight from china.I had learned a lot form your website. Best wish


Tapas 20-01-2009
Hi Michiel, Thanks, Upload files with Silverilght using HttpHandler is really helpful. Regards Tapas


Thomas W. Clay 28-01-2009
HTTP is faster? Ok, how much faster? I am building a system where there can be many binary uploads. I would like to see a progrss bar, but if HTTP is a lot aster...


Michiel 29-01-2009
@@Thomas W. Clay, The Http Handler is faster because it uses larger chunks. WCF can also be faster when you increase the chunk size. But then the progress bar will also be less fancy.


Yasser 30-03-2009
I upload the control on my production hosting server, but when I upload the file it gives me upload failure msg .... I tried all possible to avoid errors but i fail,,, IS there a way to fire the error in details to help me to trace the problem


New Comment

Name
E-mail (not published)
Comment
Enter the code shown: