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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to pass additional parameters at File Upload

Thread ID:

Created:

Updated:

Platform:

Replies:

145921 Jul 13,2019 01:39 PM UTC Jun 16,2020 10:56 AM UTC Blazor 8
loading
Tags: File Upload
MikeR
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. 

Regards, 
Berly B.C

j
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
https://www.syncfusion.com/downloads/support/directtrac/238212/ze/BlazorApp1-1587018225

Can you please allow me to download it?



j
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 17.2.0.47-beta 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.  
 
NuGet: 
 
Scripts
 

We have prepared sample and code snippet for your reference.     

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

Regards, 
Berly B.C

Christian
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 18.1.0.43?


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"> 
    </UploaderAsyncSettings> 
</SfUploader> 
 
@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. 
  
  
  
Regards, 
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.   
  
Regards,  
Berly B.C 


CONFIRMATION

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