显示多个图像和单个图像 [英] Display multi images and single image

查看:70
本文介绍了显示多个图像和单个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我有两个表名支持和FileDetail以及与支持ID相关的每个图像,所以这里我从支持表调用行,我希望在支持表上显示该行的上传图像在两个案例上



第一个案例获取[显示]该行的单个图像[任何图像]我称之为



第二个案例获取[显示] ]我所谓的那一行的所有图像



i将我的所有图像上传到文件夹〜/ App_Data / Upload /和这里使用的教程



http://techbrij.com/crud-file-upload-asp-net-mvc-ef-multiple



我尝试了什么:



i使用此代码但未向我显示此代码以供编辑





 @ foreach(Model.FileDetails中的var项目)
{
< li >
< img src = @ Url.Action( Edite,Item,new { filename = item.FileName }) < span class =code-attribute> / > < br / >
< a cla ss = title href = / Support / Download /?p = @(item.Id + item.Extension)& d=@item.FileName > @ item.FileName < / a >
< / li >
}

解决方案

您自己检查了URL吗?



您说图像存储在〜/ App_Data / Images中,但您正在创建基于操作的URL,即(如果我没有遗漏任何内容)没有映射到您的Uploads文件夹,请尝试使用它,

 <   img     src   =  ~/App_Data/Images/@item.FileName    /  >  <   br     /  >  



此外,请检查您是否可以按照该路径访问浏览器中的文件 - 看看是否为404.



其次,因为我们无事可做后期教程,我们不知道谁是作​​者,建议在帖子页面上提出这样的问题。所以作者可以自己指导你。


hey i have tow tables names Support and FileDetail and every image related with Support id so here i'm calling row from Support table and i want display uploaded images of that row which on Support table on tow case

first case fetch[display]single image of that row [any image] which i called

second case fetch[display] all images of that row which i called

i uploaded all my images on folder "~/App_Data/Upload/" and here tutorial which i used

http://techbrij.com/crud-file-upload-asp-net-mvc-ef-multiple

What I have tried:

i used this code but not show me image this code in view of edit


@foreach (var item in Model.FileDetails)
               {
                   <li>
                       <img src="@Url.Action("Edite","Item",new{ filename=item.FileName })" /><br />
                       <a class="title" href="/Support/Download/?p=@(item.Id + item.Extension)&d=@item.FileName">@item.FileName</a>
                   </li>
               }

解决方案

Did you check the URL yourself?

You said that images are stored in ~/App_Data/Images, but you are creating the Action based URL, that is (in case I'm not missing anything) not mapped to your Uploads folder, try using this,

<img src="~/App_Data/Images/@item.FileName" /><br />


Also, do check to see if you can access the file in the browser by following that path — see if that is 404.

Secondly, since we have nothing to do with post tutorial, and we do not know who is the author, it is recommended to ask such questions on the post page itself. So that author can himself guide you.


这篇关于显示多个图像和单个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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