Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send extra values with Kendo File Upload

I am trying to upload a file and file upload is successfully uploading. I am facing problem when I am sending extra values along with file upload save url.

I have Created a jsfiddle

Jsfiddle Example Link I am able to upload the files but I want to send the drowpdown value and text box value along with file upload.

    <span>Document Type
<select id="dropdownlist">
    <option>Id Proof</option>
    <option>Driving Liscence</option>
    <option>Other</option>
</select>
    <br/>
    Doc Number<input type="text" class="k-text" />
    <br/>
<div style="padding: 4px; margin-bottom: 10px;">
        Acceptable file types: .xml<br/>File size limit: 5MB
 </div>
    <input type="file" name="batchFile" id="batchFile" title="Select file" />
    <div id="upload-error" class="k-state-selected" style="padding: 4px; margin-top: 10px; display: none"></div>

<script>
$("#dropdownlist").kendoDropDownList();


$("#batchFile").kendoUpload({
    async: {
        saveUrl: '/Upload',
        autoUpload: false
    },
    multiple: false,
    localization: {
        select: "Select a file",
        uploadSelectedFiles: "Send"
    }
});
</script>
like image 933
Mohammed Farooq Avatar asked Feb 05 '14 06:02

Mohammed Farooq


1 Answers

I have updated your JSFiddle to post additional fields.

http://jsfiddle.net/dtrimarchi/bWs9j/61/

upload: function (e) {
    e.data = { dropdownlist: $("#dropdownlist").val(), docnumber: $("#docnumber").val() };
}
like image 190
Dario Trimarchi Avatar answered Oct 19 '22 05:10

Dario Trimarchi