图像没有显示在asp.net mvc中 [英] Image not showing in asp.net mvc

查看:90
本文介绍了图像没有显示在asp.net mvc中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net mvc中上传图片...以加密形式存储的数据库图片..当我检索图像但图像不显示时...



我的尝试:



//查看



< img src =@ Url.Content(@ item.resume)height =25pxwidth =50px/>

i upload image in asp.net mvc ...in database image stored in encrypt form ..now when i retrieving image but image is not display ...

What I have tried:

//view

<img src="@Url.Content(@item.resume)" height="25px" width="50px" />

推荐答案

根据评论中发布的代码,您错过了图片代码中文件的路径:

Based on the code posted in the comments, you're missing the path of the file in the image tag:
<img src="@Url.Content("~/uploadcv/" + item.resume)" height="25px" width="50px" />



或者,如果你使用MVC4或更高版本:


Or, if you're using MVC4 or higher:

<img src="~/uploadcv/@item.resume" height="25px" width="50px" />



但是,您发布的上传代码似乎并未验证上传的文件实际上是图像。如果用户上传了不同的文件类型(例如,Word文档),则无法在< img> 标记中显示。


这篇关于图像没有显示在asp.net mvc中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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