首页 > 解决方案 > Angular 将文件作为 JSON 中的一个属性发送

问题描述

我打算发布的 json 对象如下所示

export class MyPayload{
    Customer: string;
    SalesTotal: number;
    ...deleted whole bunch of other stuff and finally
    salesForcastCsvfile: blob; // ?? I want to insert file serialized here to send to asp.net core api via a post
  }

我知道如何按照此处的说明直接上传文件 但是我正在努力将文件放入内存并序列化并插入我的 json 有效负载。请指教如何做。找不到任何有关此的在线教程。

标签: angularfile-uploadangular-promiseangular-httpclient

解决方案


推荐阅读