📅  最后修改于: 2022-03-11 15:02:40.983000             🧑  作者: Mango
postFile(fileToUpload: File): Observable {
const endpoint = 'your-destination-url';
const formData: FormData = new FormData();
formData.append('fileKey', fileToUpload, fileToUpload.name);
return this.httpClient
.post(endpoint, formData, { headers: yourHeadersConfig })
.map(() => { return true; })
.catch((e) => this.handleError(e));
}