i am creating a function that loads my file from local disk and uploading it onto the firebase cloud storage. The function is able to find the file in the local disk but it shows an error firebase.storage.storageexception: could not read file . Here is my code
public void StartUpload()
{
StartCoroutine(Upload());
}
private IEnumerator Upload()
{
var storage = FirebaseStorage.DefaultInstance;
var audioreference = storage.GetReference("gs://snack-stack.appspot.com");
string local_file = "file:///" + Application.persistentDataPath + "/" + "UnityTest" + "/" + "lmao.png";
var uploadTask = audioreference.PutFileAsync(local_file);
yield return new WaitUntil(() => uploadTask.IsCompleted);
if (uploadTask.Exception != null)
{
Debug.LogError($"Failed to upload because {uploadTask.Exception}");
yield break;
}
var getUrltask = audioreference.GetDownloadUrlAsync();
yield return new WaitUntil(() => getUrltask.IsCompleted);
if (getUrltask.Exception != null)
{
Debug.LogError($"Failed to get a download url with {getUrltask.Exception}");
yield break;
}
Debug.Log($"Downloaded from {getUrltask.Result}");