Search results

Add Additional Data on Upload in ASP.NET Core Uploader control

14 Apr 2021 / 1 minute to read

The uploader control allows you to add additional data on file upload, which is used to get in the server-side. By using uploading event and its customFormData argument, you can achieve this behavior. Refer to the following example.

tagHelper
index.css
Copied to clipboard
@{
    var asyncSettings = new Syncfusion.EJ2.Inputs.UploaderAsyncSettings { SaveUrl = "https://ej2.syncfusion.com/services/api/uploadbox/Save", RemoveUrl = "https://ej2.syncfusion.com/services/api/uploadbox/Remove" };
}

<div class="control_wrapper">
    <div id='preview'></div>
    <ejs-uploader id="fileupload" uploading="onFileUpload" asyncSettings="@asyncSettings"> </ejs-uploader>
</div>
<script>

    function onFileUpload(args) {
        debugger
        args.customFormData = [{ 'name': 'Syncfusion INC' }];
    }

</script>
Copied to clipboard
.control_wrapper {
	max-width: 505px;
	margin: auto;
}