Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Create a WCF Rest Endpoint for Uploading Large Files to ASP.NET MVC

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?

like image 697
Robert Harvey Avatar asked Dec 31 '25 16:12

Robert Harvey


1 Answers

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)  
    {
         ....
like image 189
Dänu Avatar answered Jan 03 '26 05:01

Dänu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!