如何在Asp.Net MVC中的同一视图中查看上载的文件详细信息 [英] How To see uploaded File details in the same view in Asp.Net MVC

查看:74
本文介绍了如何在Asp.Net MVC中的同一视图中查看上载的文件详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在视图中上传了一首歌。我必须在使用文件上传选择歌曲后在同一视图中查看歌曲详细信息(保存的文件位置路径,文件名,文件大小,.etc)。我尝试了很多但我没有得到。任何建议被接受。谢谢。

I uploaded a song in a view.I have to see the song details(saved file location path,file name,file size, .etc) in the same view after selecting song using 'file upload' .I tried a lot but i didn't get.Any Suggestions are accepted.Thanks in advance.

推荐答案

检查这个他解释了很多关于mvc中文件上传的内容。成功上传文件后,在viewbag中保存它的名称,大小等,并将其显示在ViewBag.FileName等相同的视图上。
Check this he explains alot of things about file uploading in mvc. And after you upload file successfully save it's name, size etc. in viewbag and display it on the same view like ViewBag.FileName.


您使用viewbag显示上传文件详细信息



当页面回发时,您在视图包中显示商店信息并在视图中显示



control





public actionresult()

{

viewbag.fileinfo = filedetail;

返回视图()

}





查看方



@if(viewbag.fileinfo!=&& viewbag.fileinfo!= null)

{

hi you have use viewbag for showing upload file detail

when page postback at that time you have store information in view bag and show in view

control


public actionresult()
{
viewbag.fileinfo = filedetail;
return view()
}


view side

@if(viewbag.fileinfo !="" && viewbag.fileinfo !=null)
{
viewbag.fileinfo
viewbag.fileinfo



}


}


这篇关于如何在Asp.Net MVC中的同一视图中查看上载的文件详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆