I am trying to send *per file* form data with the upload when uploading multiple files.
<SfUploader AutoUpload="false" MaxFileSize="@maxFileSize">
<UploaderEvents OnUploadStart="OnUploadStart"></UploaderEvents>
<UploaderAsyncSettings SaveUrl="api/Upload/Save" ChunkSize=50000000></UploaderAsyncSettings>
</SfUploader>
private async void OnUploadStart(UploadingEventArgs args) {
args.CustomFormData = new[] { new { Name = "test-id", Value = Guid.NewGuid().ToString() } };
}
The form data is not being sent to the server.
If I do this in the FileSelected event (for example), then the form data fields are sent, however, they are the same for every file. I need the form data to be unique per multipart section.
The issue is that filenames may be identical (for example, if the user selects "test.jpg" from folder A and "test.jpg" from folder B, there is no way to tell them apart on the server as no path information is sent, which makes chunk processing impossible (the chunk processing example given relies on matching the filename).
The documentation says the OnUploadStart event is "used to add a parameter to the upload request"
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Inputs.UploaderEvents.html#Syncfusion_Blazor_Inputs_UploaderEvents_OnUploadStart
And the documentation for the UploadingEventArgs object says that the CustomFormData property "Gets or sets the additional data in key and value pair format to be submitted to the upload action."
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Inputs.UploadingEventArgs.html