简体   繁体   English

检索文件并将其制成可点击的格式以在新窗口中打开或可下载

[英]Retrive file and make it into a clickable format to open in new window or downloadable

i have save file path in db.and now i want to open the file from the path which i get from db and open it in new window.我在db.and中保存了文件路径,现在我想从我从db获得的路径中打开文件并在新窗口中打开它。 variable defined变量定义

public string Attach { get; set; }

path recieved in Attach variable在附加变量中收到的路径

ipcl.Attach = detail[0].Attach;

View side i want to repersent it in clickable format so that it will open in new window or downloadable.查看方面我想以可点击的格式重新显示它,以便它可以在新窗口中打开或可下载。 but didn't get any idea how to do.但不知道该怎么做。

@model lay.Models.Lell
<div>attachments<input id="Rattc" type="text" value="@Model.Attach" readonly /></div><br />

If you want to enable users to click on the file name to open it, create a link.如果您想让用户单击文件名将其打开,请创建一个链接。

<a href="@Url.Content("~/content/" + System.IO.Path.GetFileName(item.Path))"> 
    @Html.DisplayFor(modelItem => item.Nom) 
</a> 

For further details, please see: Open file from table dynamicaly with razor有关更多详细信息,请参阅: 使用 razor 动态打开表中的文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM