Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
Angular FormData cannot append my data like in React

I'm recording an audio file and sending it to a server using multipart/formdata. In React, my FormData is good, but not in Angular.

My React version works great, here it is :

let data = new FormData();             
data.append("file", {
uri: uri,
name: "file.m4a",
type: "audio/m4a",
});

If I console.log this data, I get for example :

{"_parts":[["file",{"uri":"file:///data/user/0/com.app/cache/Audio/recording.m4a","name":"file.m4a","type":"audio/m4a"}]]}

Now, I need this for Angular version, but FormData are not defined the same, and I don't know how to correct this.

If I do the same for Angular, I have an error :

Argument of type '{ uri: string; name: string; type: string; }' is not assignable to parameter of type 'string | Blob'.

And if I console.log the data, I get nothing.

What is the correct version for appending my data for Angular, with these parameters ?

In Angular, the definition of FormData is :

declare var FormData: {
    prototype: FormData;
    new(form?: HTMLFormElement): FormData;
};
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!