New to Kendo UI for jQuery? Download free 30-day trial

Serialize Form Data during Async Upload

Your project might require you to include a collection of form fields as metadata during asynchronous uploads.

The output from the commonly used jQuery.serializeArray helper is not directly usable in the upload event and needs to be processed. The following example demonstrates how to achieve this.

    <form id="form"/>
      <input type="text" name="name1" value="value1" />
      <input type="text" name="name2" value="value2" />

    <input type="file" id="files" />

        async: {
        upload: function (e) {
          var data = {};
          var form = $('#form').serializeArray();

          $.each(form, function() {
              data[] = this.value;

 = data;

The network request is expected to look like the one shown below.

Content-Disposition: form-data; name="name1"

Content-Disposition: form-data; name="name2"

Content-Disposition: form-data; name=""; filename="filename.txt"
Content-Type: text/plain


See Also

For more runnable examples on the Kendo UI Upload widget, browse its How To documentation folder.

In this article
Not finding the help you need? Improve this article