【问题标题】:Uploading large files using angular and Ionic使用 Angular 和 Ionic 上传大文件
【发布时间】:2020-06-11 15:34:19
【问题描述】:

在我们的 Ionic 移动应用程序中,我们实现了图像上传。这适用于较小的图像,但不适用于大图像。例如超过 5 MB。

我们正在从 Angular 执行 API,API 是用 .Net Core 编写的。

我们使用了电容器插件来读取图像,并且在执行 API 之前我们已将大小调整为 50%。图像以 Base64 格式传递给 API。除了图像,我们还发送表单数据。

这里的问题是,请求本身不会发送到 API。 API 托管在具有 IIS 服务器的 AWS 中。

只有有时我们会收到错误 204 No Content。但是,我们仍然不确定这一点。

下面是用 Angular 编写的代码。

CreateFormData(data) {
const jsondata = JSON.stringify(data);
return this.http.post(`${this.rootApi}${ApiEndpointUrls.saveform}`, jsondata, this.headers).pipe(
timeout(15000),
tap(async (res) => {
})
);
}

【问题讨论】:

    标签: angular asp.net-core ionic-framework file-upload angular9


    【解决方案1】:

    我不知道你是否可以在 AWS 设置上修改它.. 但你是否查看了 web.config 中的 maxRequestLength..

    <httpRuntime targetFramework="4.5" maxRequestLength="1048576" executionTimeout="9000" />
    

    【讨论】:

      猜你喜欢
      • 2020-05-27
      • 1970-01-01
      • 2018-08-22
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 2020-11-28
      • 2017-11-02
      • 1970-01-01
      相关资源
      最近更新 更多