javascript - 从 android 文件中的谷歌驱动器(云存储)附加:err_upload_file_changed 错误
问题描述
我有一个 HTML 表单,其中最后有一个 pdf 文件附件字段(),我使用所有字段表单数据发出一个发布请求
何时并选择字段 android 文件选择器打开
- 如果我从存储中选择 pdf 文件 - 没有错误- API 发布成功
- 但是,如果我从 android 文件选择器的谷歌驱动器中选择一个文件 - API 发布失败 - net::err_upload_file_changed。
PS:如果从谷歌驱动器中选择,我已经设法向用户显示一条消息,请从存储中选择,但我不希望我实际上能够发布带有附件的文件
解决方案
正如评论中所解释的,这是 Chrome 的一个错误(https://bugs.chromium.org/p/chromium/issues/detail?id=1063576)。
还可能引发以下错误:NotReadableError: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.
.
作为一种解决方法,请在进一步使用之前克隆您的文件或 Blob:
const buffer = await file.arrayBuffer();
const clone = new File([buffer], file.name, { type: file.type });
推荐阅读
- asp.net-mvc-4 - 如何在 ASP.NET MVC 应用程序中从 Microsoft JDBC Driver 6.0 for SQL Server 连接 Oracle 数据库?
- gps - GPS数据位置转换
- delphi - 在 VertScrollBox1 fmx 中排列列表
- javascript - 是否预计 Node 应用程序会随着其依赖项的较新版本的创建而停止工作?
- python - 如何使用 Mediapipe Pose 更改输出视频上跟踪点和连接线的颜色?
- wordpress - 根据帖子元自动选择分类
- python - 循环中的 Python 绘图被覆盖
- python - 我正在尝试导入:从 torchtext.legacy.data 导入字段,BucketIterator,Iterator,数据,但得到错误'没有名为'torchtext.legacy'的模块
- passcode - 如何在用户提交谷歌表单问卷之前要求唯一密码
- python - AttributeError:无法在 Google Colab 中设置属性