Use in HTML file.
<input type="file" (change)="upload($event.target.files)" />
Use in TS file
upload(files: File[]) { this.basicUpload(files); } basicUpload(file:File) { var formData = new FormData(); formData.append('file', files); this.http.post('ApiURL', formData).subscribe((event) => { console.log('done'); }); }
Note: don't use heder "Content-Type": "application/json"