1

I'm using the Kendo UI Core scripts, version 2013.2.918 to upload files asynchronously in an ASP.NET MVC3 application. Or, at least, I'm trying to.

It correctly calls the action, but the parameter is always null. Here's the code.

<form method="post" action="submit">
    <input id="fiAwardUploader" type="file"/>
</form>

$(document.ready(fuction(){
    $('#fiAwardUploader').kendoUpload({
        async:{
            saveUrl: '@(Url.Action("UploadAwardDocument"))',
            autoUpload: false //this is done for testing purposes
        }
     });
 });

 [HttpPost]
 public ActionResult UploadAwardDocument(IEnumerable<HttpPostedFileBase> fiAwardUploader)
 {
     var test = files; //this is always null
     return null;
 }

I've tried setting the form to the action as well, but it still did the same thing. I've tried naming the parameter for UploadAwardDocument to files, per the KendoUI MVC3 convention, but that still returned null.

Any mispellings are simply a problem with having to retype the code on my internet-connected laptop; everything except the fiAwardUploader parameter being null works correctly. Due to legacy coding issues, the app cannot post back here--the upload has to be async. Due to budget constraints and my personal preference, we will not be moving to the KendoUI MVC3 Professional Suite.

I'm stuck, and exactly 16 hours from having to ditch the KendoUI solution and find another async upload tool.

1 Answer 1

3

Figured it out. <input id="fiAwardUploader" type="file"/> needs to have name set as well. <input id="fiAwardUploader" name='fiAwardUploader' type="file"/> works.

This is not explicitly documented in the KendoUI documentation, and while it is mentioned in the MVC3 documentation, it's not an obvious association to make when faced with this particular issue.

Because of that, I'm going to leave the question in place, in the hope that it helps someone else.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.