angular - 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 有效负载。请指教如何做。找不到任何有关此的在线教程。
解决方案
推荐阅读
- css - 如何在 E4 RCP 中使用 css 隐藏未选择部分的边框
- javascript - 如何使用 React 内置的 React.memo 比较功能?
- python - 如何从现有的 tensorflow lite 实例中获取所有检测到的模型的名称?
- gradle - gradle 排除传递依赖
- python - 在 python 中使用字典时遇到的问题
- python - 如何跟踪 DCGAN 的损失
- javascript - React-Native:从父组件调用组件内的函数
- php - 我想在 cakephp 中创建 zip 文件。但是我的代码不起作用?
- apache - 如何在 Apache http server 2.4.43 中为特定端口记录所有 HTTP 标头
- javascript - 删除机器人消息和用户命令的 Discord.js 命令