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

Async Upload with additional fields

3 Answers 557 Views
Upload
This is a migrated thread and some comments may be shown as answers.
OnaBai
Top achievements
Rank 2
OnaBai asked on 09 Oct 2012, 09:49 PM
I'm trying to upload a file to a document in CouchDB.
To do so, I need to provide the document identifier as part of the url AND a revision as an additional field. This is not a problem if I'm submitting a form with both inputs (revision and file) but I wonder if it is possible with asynchronous upload do something similar. Is it? How? 

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 11 Oct 2012, 07:42 AM
Hi Emiliano,

Unfortunately the Upload does not support the described behavior, i.e. it cannot send additional data to the server. You should use the widget's events and post the other fields manually.

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 18 Oct 2012, 07:18 PM
I'm not exactly sure what you're asking, but I am sending two drop down values with my async upload by attaching them to the saveUrl.

$("#files").kendoUpload({
    async: {
        saveUrl: "save",
        autoUpload: true
    },
    upload: function (e) {
        e.sender.options.async.saveUrl = "save?t=" + $("#t").val() + "&q=" + $("#q").val();
    }
});
$("#files").data("kendoUpload").options.async.saveUrl = "save?t=" + $("#t").val() + "&q=" + $("#q").val();

Something like that.
0
Daniel Probst
Top achievements
Rank 1
answered on 22 Nov 2012, 09:44 AM
The same works quite well using Razor:
@(Html.Kendo().Upload()
 .Name("files")
 .Async(a => a.Save("Save", "Media", new { dir = "bla" })
  .Remove("Remove", "Media")
  .AutoUpload(false))
)

and here's the controller:
public ActionResult Save(IEnumerable<HttpPostedFileBase> files, string dir)
Tags
Upload
Asked by
OnaBai
Top achievements
Rank 2
Answers by
Dimo
Telerik team
David
Top achievements
Rank 1
Daniel Probst
Top achievements
Rank 1
Share this question
or