Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

How can send a sound file to server side with FormData

$
0
0

@umutgur wrote:

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);

    console.log(postModel);

    return this.http.post(url, formData , { headers: headers });
  }

How can do that?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>