Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
Sending parameters with fileUpload
posted

Ive tried this and e.AdditionaldataFields is always null serverside, can you provide a working example ?

Parents
  • 23953
    Offline posted

    Hello Mark,

    I'm attaching a sample for your reference.

    In the sample the "Index.cshtml" contains the igUpload configuration where the ID("upload1") and ControlId("upload1") are set in order to make the client-side and server-side event wiring. Also the onFormDataSubmit event is handled in order to send the additional data with the file upload to the server:

    <script>
    
        $(function () {
            $("#upload1").on("iguploadonformdatasubmit", function (evt, ui) {
                $("#upload1").igUpload("addDataField", ui.formData, { "name": "Test Name", "value": "Test value" });
            });
        });
    
    </script>
    
    @Html.Infragistics().Upload().ID("upload1").ControlId("upload1").Render()

    In "Global.asax" there is the server-side event wiring with this code:

    UploadProgressManager.Instance.AddStartingUploadEventHandler("upload1", new EventHandler<UploadStartingEventArgs>(HomeController.igUpload_UploadStarting));

    In the "HomeController.cs" there is the server-side "StartingUpload" event handler:

    public static void igUpload_UploadStarting(object sender, Infragistics.Web.Mvc.UploadStartingEventArgs e)
    {
        foreach (var dataField in e.AdditionalDataFields)
        {
            string fieldName = dataField.Name;
            string fieldValue = dataField.Value;
        }
    }
     

    Best regards,
    Martin Pavlov
    Infragistics, Inc.

    7587.IgniteUISample.zip

Reply Children
No Data