javascript - 如何替换 Firebase 存储桶上的文件?
问题描述
我正在从 node.js 服务器将图像上传到我的 firebase 存储桶,如下所示:
bucket.upload(files.image.path, {metadata: {contentType: files.image.type}});
A 还想替换已经上传的文件。例如,如果我编辑文件并想上传新版本,则覆盖旧版本。
我在谷歌上读到我可以通过指定旧文件的名称来替换文件,但我尝试了以下似乎不起作用的方法:
bucket.upload(files.image.path, {metadata: {contentType: files.image.type, name: fields.filename}});
...但它告诉我:
Value 'upload_8b8702384ca2686b8a0a0de7102f2804' in content does not agree with value 'upload_73065f47da4149eee391cd09a01f628a'. This can happen when a value set through a parameter is inconsistent with a value set in the request.
什么是正确的方法?
谢谢
解决方案
推荐阅读
- continuous-integration - wercker 中的链式管道(默认执行)不会产生结果
- c - 宏 - 生成 4 位查找表
- c++ - 调暗 vscode 中未使用的变量
- angular - 未捕获的错误:无法解析 HacksStorageService 的所有参数:([object Object],?)。在语法错误
- html - 为整个页面添加噪音
- reactjs - 找不到变量:React Native 的 react-native-material-bottom-navigation 中的选项卡
- c# - NHibernate如何将外键关系映射到多个属性
- python - 了解 Python 堆栈中的递归
- ios - 使用 Firebase 制作 iOS 应用原型
- r - 与 R 中的 MLR 估计器进行逻辑 3 路交互