I new here. Actually, I need to know how to upload image to server. Because when I try to upload I got this error.
This my code
HTML
<input type="file" name="files" (change)="fileUpload($event)" accept='image/gif' />
Component
fileUpload(event:any){
this.image = event.target.files[0].name;
let itemCode = this.activatedRoute.snapshot.paramMap.get('id');
return this.http.post(environment.apiBaseUrl + environment.path + '/data/uploadgif', {file: this.image, menuCode: itemCode})
.subscribe((data) => {
if(data['status']['code'] === 0) {
document.location.href = environment.url;
} else {
}
});
}
Hope you all can help me Thanks in advance