Search results

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

08 Dec 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.

razor
index.css
Copied to clipboard
<div class="control_wrapper">
    @Html.EJS().Uploader("fileupload").Uploading("onFileUpload").AsyncSettings(new Syncfusion.EJ2.Inputs.UploaderAsyncSettings { SaveUrl = "https://ej2.syncfusion.com/services/api/uploadbox/Save", RemoveUrl = "https://ej2.syncfusion.com/services/api/uploadbox/Remove" }).Render()
</div>

<script>
function onFileUpload(args) {
  args.customFormData = [{'name': 'Syncfusion INC'}];
}
</script>
Copied to clipboard
.control_wrapper {
	max-width: 505px;
	margin: auto;
}

You can also explore ASP.NET MVC File Upload feature tour page for its groundbreaking features. You can also explore our ASP.NET MVC File Upload example to understand how to browse the files which you want to upload to the server.