This is a migrated thread and some comments may be shown as answers.

Possible to Post Files to Controller via jQuery instead of through the .Save Action?

1 Answer 80 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Landon
Top achievements
Rank 2
Landon asked on 29 Oct 2013, 06:56 PM
Hi,

I'm looking to use the Kendo Upload control to Import vCards onto a Contact Creation page. Since I want to return a PartialView, and populate a Div's .html attribute, I'd like to do this as a jQuery Post like I've outlined below:
@(Html.Kendo().Upload()
     .Name("vCard")
     .Async(a => a
         .Save("UploadContact", "Contacts") /*Don't really need this if I can post via jQuery */
         .AutoUpload(true)
         )
     .Events(events => events
         .Select("onSelect")
         .Upload("onUpload")
         )
     .ShowFileList(false)
     .Multiple(false)
     )
function onUpload(e) {
        var upload = $("#vCard").data("kendoUpload");
        var files = upload.files;
 
        var serialized = "vCard=" + files;
        $.post("/Contacts/UploadContact/", serialized, function (returnHtml) {
            //alert(returnHtml);
            $("#ContactContainer").html(returnHtml);
        });
My issue is that I am constantly getting a null object when posting to /Contacts/UploadContact using jQuery.

Is there any way to pass the entire file list (including FileStream) back to the controller from jQuery like I've outlined in the "onUpload" method?

Any help would be greatly appreciated.

Thanks,
Landon

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 30 Oct 2013, 04:07 PM
Hello Landon,


The Upload widget does not support such scenario. If you would like to manually implement file upload functionality, you could find additional information on the internet.

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Upload
Asked by
Landon
Top achievements
Rank 2
Answers by
Dimiter Madjarov
Telerik team
Share this question
or