I have saved some files in SQL table through an application in admin side, but now I have to take back the files saved in the table to a folder in another application to the website. I need to save the files in a folder called MyFiles and want to download the files by clicking on the download link controller
public ActionResult Index()
{
var Downloads = db.Downloads.ToList();
return View(Downloads);
}
View
@model List<ThaniyamBank.Models.Download>
<div class="row">
@foreach (var item in Model)
{
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12 form_cont">
<p class="all_sub_hed">@item.ItemName</p>
<p class="tet">@item.Description</p>
<a href="http://localhost:56572/MyFiles/@(item.Url)" class="hvr-icon-back">Download Form</a>
</div>
}
</div>
this is my folder which I need to save the data from table
the files shows here is which I have added directly
How can I get files directly from table
this is my table called downloads
Here the Url column is the name of the file with extension, I need to get this Url to the folder myFiles in the application. How can I get the files from table? can anyone please help me to find the solution, how the working ??


Server.MapPathwith directory path where the files saved into and file name taken from DB (assumed EF is being used, you can query byBankEntities.Downloads.Where(...).Select(x => x.Url), e.g.Server.MapPath("~/MyFiles" + model.Url).