Hi,
I'm using MVC 4, Knockout, and the KendoUI Upload widget.
I have a simple form with several fields plus a single file upload to allow the user to upload one file.
I want it all to go back to the controller in a submit method something like "public ActionResult Submit( Model model, IEnumerable<HttpPostedFileBase> file ). I don't want to use async uploading.
As it turns out, the model is properly populated, but both the "file" parameter and Request.Files are empty.
Could someone provide a full *working* example? I've spent hours scouring this site, StackOverflow, and more without finding such an example.
Thanks!
I'm using MVC 4, Knockout, and the KendoUI Upload widget.
I have a simple form with several fields plus a single file upload to allow the user to upload one file.
I want it all to go back to the controller in a submit method something like "public ActionResult Submit( Model model, IEnumerable<HttpPostedFileBase> file ). I don't want to use async uploading.
As it turns out, the model is properly populated, but both the "file" parameter and Request.Files are empty.
Could someone provide a full *working* example? I've spent hours scouring this site, StackOverflow, and more without finding such an example.
Thanks!
5 Answers, 1 is accepted
0
Hello,
Tsvetomir Tsonev
the Telerik team
We are not aware of any problems that can cause such behavior.
You might want to verify that the Upload is placed within the form and that its name is set to "file". You can also verify that your view/controller are set up correctly by replacing the Upload with a regular input type='file' element.
The downloadable KendoUI for ASP.NET MVC demos do contain working Upload examples. Please refer to this help topic for more information.
I hope this helps.
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Boris
Top achievements
Rank 1
answered on 29 Aug 2012, 01:50 PM
Thanks for the response. The Web trial I had downloaded didn't have any instructions about MVC set up, so I added the necessary references, dll, etc.
The MVC Upload example doesn't include other form fields and a model, so it doesn't help with my situation...
If I use a simple Submit button, the "file" parameter of the controller action is set but the model parameter is empty. If I use ko.Html.Button then I get the model but the file parameter is null. It seems I can get the model or the file, but not both.
The MVC Upload example doesn't include other form fields and a model, so it doesn't help with my situation...
If I use a simple Submit button, the "file" parameter of the controller action is set but the model parameter is empty. If I use ko.Html.Button then I get the model but the file parameter is null. It seems I can get the model or the file, but not both.
0
Boris
Top achievements
Rank 1
answered on 30 Aug 2012, 12:53 AM
With the Submit button, the Request.Form collection is empty - which is why the model parameter can't be populated...
0
Accepted
Hi,
Tsvetomir Tsonev
the Telerik team
I've created a simple project and everything seems to work fine with it. Can you please try it as well? Maybe you can spot some differences with your code.
Greetings,Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Boris
Top achievements
Rank 1
answered on 31 Aug 2012, 03:45 PM
Thanks for the sample project. I've verified it works.
The key difference is that you're using <INPUT> controls with "type" and "id" attributes.
In my original project I was using neither, using the KendoUI $.(...).xxx({...}) method to specify how the <DIV> controls should be rendered and made to behave.
The key difference is that you're using <INPUT> controls with "type" and "id" attributes.
In my original project I was using neither, using the KendoUI $.(...).xxx({...}) method to specify how the <DIV> controls should be rendered and made to behave.