top of page
Post: Blog2_Post
Search

How to Upload File to Firebase Storage using asp.net C#

//Step 1: Create the following function to upload the file

public async void uploadFile()

{

var stream = File.Open(@"d:\sankar.png", FileMode.Open);

var auth = new FirebaseAuthProvider(new Firebase.Auth.FirebaseConfig("Api Key"));

var a = await auth.SignInWithEmailAndPasswordAsync("xxxx@xxxxl.com", "password");

string fn = DateTime.Now.Ticks.ToString()+".jpg";

var task = new FirebaseStorage(

"xxxxxxx-xxxxxx.appspot.com",


new FirebaseStorageOptions

{

AuthTokenAsyncFactory = () => Task.FromResult(a.FirebaseToken),

ThrowOnCancel = true,

})

.Child("Categories")

.Child(fn)

.PutAsync(stream);


task.Progress.ProgressChanged += (s, e) => Console.WriteLine($"Progress: {e.Percentage} %");

var downloadUrl = await task;

}




//Step 2 add the following highlighted one

<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="Category_master.aspx.cs" Inherits="admin.visakhadairy.com.Category_master" Async="true" %>


9 views0 comments

Recent Posts

See All

How to create cursors in microsoft sql server

-- how_to_use_cursors 2023,9 alter procedure how_to_use_cursors @year bigint, @month bigint as begin declare @employee_id bigint declare @No_of_days_present bigint declare @total_no_of_days bigint dec

bottom of page