How can send a sound file to server side with FormData

Hello there,

I want send sound file to server with a post request, server side is a .net web api application.

I can send form datas, but how can send a sound file?

I wrote following codes for post request;

post(postModel: PostModel): Observable<Object> {

    let url: string = this.apiUrl + "/posts/record";
    let formData: FormData = new FormData();

    let headers = new HttpHeaders()
      .set('Authorization', btoa("user" + ":" + "password"));

    formData.append('userID', this.postModel.userID.toString());
    formData.append('dateTime', this.postModel.dateTime);
    formData.append('text', this.postModel.text);


    return, formData , { headers: headers });

How can do that?

1 Like

same problem with me :frowning: … any updates ?