How to send an image per post in the angle

0

I would like to know how I can be sending an image to an angle 6 through the post method.

First I should encode this image in base 64 and then I'll send all that coding as a value of a key ????

    
asked by anonymous 27.07.2018 / 18:45

1 answer

1

In Angular 6, you can send the bits of the image in the body of the POST request.

sendImage(imagem) {
  return this.httpClient.post(URL, imagem, {headers: this.headers});
}

And then the server would process the bits of the image and store the file in memory. You can use the same logic with the PUT request.

Sending through a GET request culminates in placing the bits of the image in the request header.

    
27.07.2018 / 18:55