0

I want to pass document field in my form as an object like

formData.append('document', {
      uri: this.fileUrl,
      type: this.file.type,
      name: this.file.name
    });

There are multiple fields which I use like

const formData: any = new FormData();
    sellerType.map(x => {
      formData.append('sellerType', x);
    });
    formData.append('name', this.sellerRegisterForm.value.sellerName);
    formData.append('email', this.sellerRegisterForm.value.email);
    formData.append('password', this.sellerRegisterForm.value.password);
    formData.append('contactNo', this.sellerRegisterForm.value.contactNo);
    formData.append('comp_name', this.companyRegisterForm.value.companyName);
    formData.append('comp_contactNo', this.companyRegisterForm.value.contactNo);
    formData.append('document', {
      uri: this.fileUrl,
      type: this.file.type,
      name: this.file.name
    });

but it is not accepting !! Please anyone can help me with this or if I'm doing anything wrong then please corrent my code that how can I pass this kind of object in formdata...

radhika thakkar
  • 125
  • 2
  • 9

0 Answers0