CustomFormData can handle complex object as a value ?

Hello,

I'm trying to send together a file and some custom data using the uploader component.
When using the customFormData, if I use only primary types for values it's ok but i actually need to send a more complex object as a JSON.

The problem is that the values becomes [object object] when is sent. 

So I tried to stringify the object but the problem is that I cannot specify the Content-Type for that part on the multipart request for the backend to serialize it correctly...

Do you have some advice ?

Thanks in advance.


Mihai


1 Reply

BC Berly Christopher Syncfusion Team July 29, 2021 10:06 AM UTC

Hi Buzatu, 
  
Greetings from Syncfusion support. 
  
We can send the complex object as a additional data in the customFormData on uploading event as mentioned in the below code example. 
  
public onFileUpload(argsany) { 
  // add addition data as key-value pair. 
  args.customFormData = [ 
    { name: 'Syncfusion INC' }, 
    { 
      type: 'string' 
    }, 
    { authorization: true } 
  ]; 
} 
 
  
Screenshot: 
 
  
  
  
Regards, 
Berly B.C 
1

Loader.
Up arrow icon