Answer:
File uploader component allows to add an additional header on file upload and can be received in the server-side. We can achieve this behavior using FileSelected / BeforeUpload event and its CurrentRequest argument by configuring the header as key-value pair.
<EjsUploader ID="UploadFiles">
<UploaderEvents FileSelected="onFileSelect">UploaderEvents>
<UploaderAsyncSettings SaveUrl="https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save" RemoveUrl="https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove">
UploaderAsyncSettings>
EjsUploader>
@code {
private void onFileSelect(SelectedEventArgs
args)
{
var accessToken
= "Basic
test123";
args.CurrentRequest = new List<object> { new { Authorization
= accessToken } };
}
} |
Find the sample for send the Request with a bearer token in Blazor File Upload from
here.