简体   繁体   中英

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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