大家好,我有一个 FileUpload 控件,用户可以在其中上传图像和 Doc 文件,当我从数据库中检索数据时,我现在将路径的 Url 保存在我的数据库中,我想检查文件是 .doc 还是图像是文档,它将打开文件我的问题是我如何为图像执行此操作我如何检查它的图像我必须在图像控件中显示图像从未在 MVC3 中的图像控件上工作过
这是我的控制器代码
public ActionResult ViewAttachments(string AttachmentName)
{
try
{
AttachmentName = Session["AttachmentUrl"].ToString();
var fs = System.IO.File.OpenRead(Server.MapPath(" "+ AttachmentName+" "));
return File(fs, "application/doc", AttachmentName);
}
catch
{
throw new HttpException(404, "Couldn't find " + AttachmentName);
}
}
我在这里使用一个aspx页面我必须使用什么html以及我必须在这里更改的代码是什么请有任何建议