尝试将文件上传到Firebase存储时出现错误[对象对象]

时间:2020-02-22 07:36:15

标签: angular firebase firebase-storage angularfire2 angularfire

我一直试图将图像上传到Angular上的Firebase存储。这是一段代码

const randomId = Math.random().toString(36).substring(2);
const ref = this.storage.ref(randomId);
const task = ref.put(file);

错误发生在最后一行

我用另一种上传方式替换了最后一行(根据角度文档)

    const task = this.storage.upload(filePath, file);

但是发生同样的错误

这是错误:

ERROR Error: [object Object]
at viewWrappedDebugError (core.js:22194)
at callWithDebugContext (core.js:36417)
at Object.debugHandleEvent [as handleEvent] (core.js:36043)
at dispatchEvent (core.js:22533)
at core.js:33721
at HTMLButtonElement.<anonymous> (platform-browser.js:1789)
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:30885)
at ZoneDelegate.invokeTask (zone-evergreen.js:390)
at Zone.runTask (zone-evergreen.js:168)

0 个答案:

没有答案