我有一个委托方法,当WritingAnObject上传文件时会调用它。我想使用args.PercentDone值更新MVC页面中的div(ProgressUpdate)。请提供任何建议?
谢谢,
谢谢,
private void displayProgress(object sender, ProgressArgs args)
{
//Console.WriteLine(args.PercentDone); //I want to display args.PercentDone in the page
}
//控制器
[HttpPost]
public ActionResult WritingAnObject(MyViewModel bovModel)
{
//DoSomeStuff which is cause calling displayProgress
return RedirectToAction("ListingSomeInfo", "testpart");
}
//视图
<%using (Html.BeginForm("WritingAnObject", "testpart", FormMethod.Post, new { enctype = "multipart/form-data" }))
{%>
<%:Html.TextBox("catname") %>
<input type="file" id="fileupload" name="fileupload" />
<input type="submit" value="Upload" />
<%} %>
<div id= “ProgressUpdate”</div>
HTML5
或者Flash
。在这里搜索“HTML上传进度”,你会发现第一个结果是这个非常高评价的帖子,讨论了使用HTML5的选项 - https://dev59.com/vXVC5IYBdhLWcg3w1E_w#8758614 - Snixtor