firebase storage PutFileAsync Could not read file
i'm got error
System.AggregateException: One or more errors occurred. ---> Firebase.Storage.StorageException: Could not read file. --- End of inner exception stack trace --- ---> (Inner Exception #0) Firebase.Storage.StorageException: Could not read file.<---
UnityEngine.Debug:Log(Object) <>c_DisplayClass4_0:b_0(Task`1) (at Assets/Worker/Script/UnKnowError.cs:40) System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()
public class UnKnowError : MonoBehaviour { FirebaseStorage storage; StorageReference storage_ref;
void Start()
{
storage = Firebase.Storage.FirebaseStorage.DefaultInstance;
storage_ref = storage.GetReferenceFromUrl("gs://sandworker-47e95.appspot.com");
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.B))
{
UploadPicture();
}
}
private void UploadPicture()
{
string local_file = "file:///C:/pic/TestPic.jpg";
// Create a reference to the file you want to upload
StorageReference rivers_ref = storage_ref.Child("TestPic.jpg");
// Upload the file to the path "images/rivers.jpg"
rivers_ref.PutFileAsync(local_file).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.
StorageMetadata metadata = task.Result;
string DownLoad_Url = rivers_ref.GetDownloadUrlAsync().ToString();
Debug.Log(DownLoad_Url);
}
});
}
} Oh!!!!!! please tell me What i'm worng?????
Answer by westdev · Jan 01 at 12:46 PM
if some one facing the same problem you can check the name of the folder you put your images in, i had same problem because the folder name was in arabic language, so change it to english alphabits, maybe this could help some one with same case.