I'm new to this framework, can anyone tell me how to upload an image with other fields in a form to the server using POST?
Currently, I know how to send value from the fields using POST, but without image.
let headers = new Headers({
'Content-Type' : 'application/json'
});
let options = new RequestOptions({ headers: headers });
let data = JSON.stringify({
username: username, password: password
});
return this.http.post(this.baseUrl+"/login/auth", data, options)
.map(res => res.json())
.toPromise()
.catch((error) => {
console.log("Login failed");
return Promise.reject(error);
});