📜  angualar 图像上传服务 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:40.983000             🧑  作者: Mango

代码示例1
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));
}