本文介绍了Firebase存储在尝试上传图片时发生StorageException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试将图片上传到新的Firebase存储服务。它抛出StorageException
解决方案
在google firebase中,这种类型的 StorageException
通常是由于错误的
StorageReference
引用引起的。
FirebaseStorage存储= FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl(gs://< your-bucket-name>);
//创建对文件的引用
StorageReference mountainsRef = storageRef.child(file.jpg);
确保文件的引用正确。
文档参考 $ b
I have been trying to upload images to the new firebase storage service . It is throwing StorageException
解决方案
In the google firebase this type of StorageException
are commonly caused because of wrongStorageReference
reference .
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>");
// Create a reference to "file"
StorageReference mountainsRef = storageRef.child("file.jpg");
Make sure the reference to the file is made correctly.
Documentation Refrences
Details about creating Storage reference can be found in here
Details about the Storage Exception codes can be found in here for further refrences
这篇关于Firebase存储在尝试上传图片时发生StorageException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!