I am using angular 6.I am sending image file data through form data.But I am enable to get file data in API.here is my code
UpdateLogoprofile(data: any): Observable<any> {
debugger;
const model = {};
const url = AppSettings.API_ENDPOINT + 'Client/UploadFileToStorage';
console.log(data);
// const body = JSON.stringify(data);
//const body = data;
const httpOptions = {
headers: new HttpHeaders({
'content-type': 'application/json',
'Authorization': 'bearer ' + this.auth_token + ''
})
};
return this.http.post(url, data, httpOptions)
// .map(this.extractData)
.map((response: Response) => <any>response.json())
.catch(this.handleError);
}
and FormData
let formData: FormData = new FormData();
formData.append(file.name,file);
// formData.append('StudentId',this.StudentID);
debugger;
this._ClientService.UpdateLogoprofile(data).subscribe(
image => {
The Problem:
I am not able to acces formData
in API