We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to pass additional parameters at File Upload

Thread ID:





145921 Jul 13,2019 01:39 PM UTC Apr 12,2021 12:38 PM UTC Blazor 9
Tags: File Upload
Asked On July 13, 2019 01:39 PM UTC

How can I pass additional parameters together with the file upload and then access them in the controller.

Berly Christopher [Syncfusion]
Replied On July 15, 2019 06:05 AM UTC

Hi Mikael,   
Sorry for the inconvenience.  
This was a known issue in our File uploader component. We are currently working on it and will include the fix in our upcoming release, which is expected to be rolled out by end of July 2019.   
Please find the feedback portal link to track this defect status.    
We appreciate your patience until then. 

Berly B.C

Replied On March 27, 2020 03:28 AM UTC

Hi Syncfusion,

   I cannot download the given sample from here
permission denied.

The file I'm trying to download is

Can you please allow me to download it?

Replied On March 27, 2020 03:40 AM UTC

Actually what I'm trying to do is how can I retrieve the custom headers (which is essentially param) in the Controller:

public async Task Save(IList<IFormFile> uploadFiles) { ... }

Berly Christopher [Syncfusion]
Replied On March 27, 2020 10:04 AM UTC

Hi Mikael, 

Sorry for the inconvenience caused. 

Now the feedback link is accessible and we are glad to announce that our latest release in the version has been rolled out successfully and, in that release,, we have included the “The custom header not able to add in uploading file request”. You can use FileSelected event and set your header in CurrentRequest argument (args.CurrentRequest) based on key-value pair.  

We have prepared sample and code snippet for your reference.     

@using Syncfusion.EJ2.Blazor 
@using Syncfusion.EJ2.Blazor.Inputs 
<h4Upload custom header </h4> 
    <UploaderEvents FileSelected="OnFileSelect"></UploaderEvents> 
    <UploaderAsyncSettingsSaveUrl ="https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save" RemoveUrl="https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove"> </UploaderAsyncSettings> 
    public void OnFileSelect(SelectedEventArgs args) 
        args.CurrentRequest = new List<object> { new { custom - header = "Syncfusion" } }; 

Berly B.C

Replied On April 14, 2020 01:01 AM UTC

Hello Syncfusion,
I'm also looking into how I can send along a parameter/identifier with the file upload.  Is it currently in version

Berly Christopher [Syncfusion]
Replied On April 14, 2020 10:19 AM UTC

Hi Christian, 
Yes, we have the support for sending custom form data for the Uploader in the latest version on selected event. We have prepared the sample and attached it below.  
@using Syncfusion.Blazor.Inputs 
<SfUploader ID="UploadFiles"> 
    <UploaderEvents FileSelected="onFileSelect"></UploaderEvents> 
    <UploaderAsyncSettings SaveUrl="api/SampleData/Save"> 
@code { 
    private void onFileSelect(SelectedEventArgs args) 
        args.CustomFormData = new List<object> { new { Name = "Syncfusion" } }; 

Please find the below documentation to know more about Uploader component. 
Berly B.C 

Irakli Gabadze
Replied On June 15, 2020 11:58 AM UTC

There is no need of some extra js work. just look at my images. You can pass and get custom parameters very easily in this way.

Attachment: images_5468b3d6.zip

Berly Christopher [Syncfusion]
Replied On June 16, 2020 10:56 AM UTC

Hi Irakli,   
Thanks for the suggestion and it is working for us.   
Berly B.C 

Mr Andrey Voronov
Replied On April 12, 2021 12:38 PM UTC

what if header name is a variable:

var headername = "Custom.Header"

this does not work:

args.CurrentRequest = new List<object> { new object[] { headername, "Syncfusion" } }; 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon