Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230627

The image is not being posted to api in ionic

$
0
0

I’m working on the ionic application which uses POST API. And I am feeding that POST API with an image/blob but not taking that image into it. If the api took the image then it’ll return a string as an output and it should be visible in the HomePage in ionic.

Here is the code.

givetoapi(){
  var uploadingImage = new Image();
  uploadingImage.src = "../assets/imgs/banana.jpg";
  let headers = new Headers();
  headers.append('content-type','image/*');
  let url = 'http://af46cff3.ngrok.io';
  let postData = JSON.stringify({
    key :'predimg',
    value :downloadingImage.src
  })
  let data:Observable<any> = this.http.post(url,postData)
  data.subscribe((result) => {
    console.log(result)

Viewing all articles
Browse latest Browse all 230627

Latest Images

Trending Articles



Latest Images

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