views:

387

answers:

1

Can WCF be used to create an endpoint for uploading large files to a website via an ASP.NET MVC controller method, with a jQuery progress bar in the browser being updated with Ajax or Json?

How would it be done? Are code samples available?

+1  A: 

There's an MSDN article on large files and WCF. Large Data and Streaming In the web.config of the WCF service you have to increase the maxRequestLength (described on maxRequestLength

The view should look like this

 <%using(Html.BeginForm("ActionName",  
                        "ControllerName",  
                        FormMethod.Post,  
                        new {enctype = "multipart/form-data"})) {%> ...

The controller should look like the following

[AcceptVerbs(HttpVerbs.Post)]  
    public ActionResult ActionName(HttpPostedFileBase file)  
    {
         ....
Dänu