- Home /
how to solve Firebase.Storage.StorageException?
i'm trying to use firebase storage to upload images. and here is what I've tried.
public void firetalk(string path)
{
Firebase.Storage.FirebaseStorage storage = Firebase.Storage.FirebaseStorage.DefaultInstance;
Firebase.Storage.StorageReference storage_ref = storage.GetReferenceFromUrl("gs://<myurl>.appspot.com/");
Firebase.Storage.StorageReference art_image_ref = storage_ref.Child("images/innocence.jpg");
art_image_ref.PutFileAsync(path).ContinueWith((Task<StorageMetadata> task) =>
{
if (task.IsFaulted || task.IsCanceled)
{
Debug.Log(task.Exception.ToString());
// Uh-oh, an error occurred!
}
else
{
// Metadata contains file metadata such as size, content-type, and download URL.
Firebase.Storage.StorageMetadata metadata = task.Result;
string download_url = metadata.DownloadUrl.ToString();
Debug.Log("Finished uploading...");
Debug.Log("download url = " + download_url);
}
});
}
the firetalk funtion recieves a path and i use PutFileAsync
for using the upload using path ,however i'm getting this error..
System.AggregateException: Exception of type 'System.AggregateException' was thrown.
Firebase.Storage.StorageException: Permission denied. Could not perform this operation UnityEngine.Debug:Log(Object) GracesGames.SimpleFileBrowser.Scripts.explorer_script:m_0(Task`1) (at Assets/scripts/explorer_script.cs:85) System.Threading.Tasks.TaskCompletionSource`1:SetException(Exception) Firebase.Storage.StorageReference:CompleteTask(Task`1, TaskCompletionSource`1, Func`1, String, Boolean) Firebase.Storage.cAnonStorey6:<>m0(Task`1) System.Threading.Tasks.TaskCompletionSource`1:SetException(Exception) Firebase.Storage.cAnonStorey0:<>m_0() Firebase.Storage.Future_StorageMetadata:SWIG_CompletionDispatcher(Int32) Firebase.AppUtilPINVOKE:PollCallbacks() Firebase.AppUtil:PollCallbacks() Firebase.Platform.FirebaseAppUtils:PollCallbacks() Firebase.Platform.FirebaseHandler:Update() Firebase.Platform.FirebaseMonoBehaviour:Update()
any gueses?
Your answer
