Skip to content

Instantly share code, notes, and snippets.

@bezysoftware
Created January 3, 2017 13:52
Show Gist options
  • Select an option

  • Save bezysoftware/3321d605cef3cde920e158451d467a0e to your computer and use it in GitHub Desktop.

Select an option

Save bezysoftware/3321d605cef3cde920e158451d467a0e to your computer and use it in GitHub Desktop.
// Get any Stream — it can be FileStream, MemoryStream or any other type of Stream
var stream = File.Open(@"C:\YourFile.png", FileMode.Open);
// Construct FirebaseStorage with path to where you want to upload the file and put it there
var task = new FirebaseStorage("your-bucket.appspot.com")
 .Child("data")
 .Child("random")
 .Child("file.png")
 .PutAsync(stream);
// Track progress of the upload
task.Progress.ProgressChanged += (s, e) => Console.WriteLine($"Progress: {e.Percentage} %");
// Await the task to wait until upload is completed and get the download url
var downloadUrl = await task;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment