IgniteUI / ignite-ui

Ignite UI for jQuery by Infragistics
https://bit.ly/2kuu1fT
Other
477 stars 83 forks source link

When igUpload has useSingleRequest: true additional parameters added to the form data are not processed correctly on the server side. #2134

Open MayaKirova opened 3 years ago

MayaKirova commented 3 years ago

Description

When igUpload has single requests enabled and some additional parameters are added via addDataField method:

  $("#upload").on("iguploadonformdatasubmit", function (evt, ui) {

        $("#upload").igUpload("addDataField", ui.formData, { "name": "Parameter Name", "value": "Value" });

    });

The additional parameters for the server side UploadStarting event do not populate correctly in the event args - e.AdditionalDataFields is empty.

Note: Issue seems to be with the order of the parameters added to the form data. If the additional parameters are added first and then the file it works as expected. Probably event formdatasubmit should be fired before adding the file to the form data.

Steps to reproduce

  1. Run the attached sample.
  2. Upload a file

Note: if useSingleRequest is not set then it works as expected.

Result

Server side handler throws error because e.AdditionalDataFields is null

Expected result

e.AdditionalDataFields is populated correctly.

Attachments

UploadSample.zip

PeteSral commented 3 years ago

@MayaKirova do you think this issue also affects the MVC assembly as well? I'm running into a similar issue using Infragistics.Web.Mvc?

MayaKirova commented 3 years ago

@PeteSral Yes. As the issue seems to be in the client-side code of the igUpload, which is the same regardless of the backend handler/module used it would reproduce with Infragistics.Web.Mvc.