Firebase Mvc显示进度条百分比

时间:2019-02-09 00:13:47

标签: asp.net-mvc asp.net-ajax firebase-storage ajaxform

// Get any Stream - it can be FileStream, MemoryStream or any other type of 
// Stream
var stream = File.Open(@"C:\Users\you\file.png", FileMode.Open);

// Constructr FirebaseStorage, 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 completes and get the download url
var downloadUrl = await task;

如何返回进度条的百分比并显示大文件的上传百分比。我需要知道应该返回什么ActionResult? JsonResult? ContentResult?以及如何从我的ajax帖子中获取百分比。

0 个答案:

没有答案