TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
U Thu
NA
336
22.2k
File Downlaod Problem in .net core
Nov 29 2017 5:16 AM
My project is DL project.This project store data and upload file.sql database of FileUploadPath is store upload file name.Upload progress is Ok.But download this DL PDF File progress is problem in now time.I would like to download link buttion click DL PDF Downloaded to Computer.This download file click action chtml is look like this
<td style="text-align:center">
@Html.DisplayFor(modelItem => item.Confirm.ApprovedStatus) <i class="glyphicon glyphicon-ok"></i>
</td>
<td>
<a asp-action="Download" asp-route-id="@item.ID" class="btn btn-link">Download</a>
</td>
<td class="hidden-print">
<a asp-action="Edit" asp-route-id="@item.ID" class="btn btn-primary"><i class="glyphicon glyphicon-pencil"></i> Edit</a> |
<a asp-action="Details" asp-route-id="@item.ID" class="btn btn-info"><i class="glyphicon glyphicon-book"></i> Details</a> |
<a asp-action="Delete" asp-route-id="@item.ID" class="btn btn-danger"><i class="glyphicon glyphicon-trash"></i> Delete</a>
</td>
Nex this route is item.ID therefore Download Action is LookLike this
public FileResult Download(int id)
{
var Getfilename = _context.REHPData.FromSql("SELECT UploadFilePath" +
"FROM REHPData " +
"WHERE ID IN (@p0)", id);
string uploadpath = Path.Combine(_environment.WebRootPath, "UploadFiles");
var FilePath = Path.Combine(uploadpath, Getfilename.ToString());
return File(FilePath, "application/pdf");
}
This above action method using SELECT method.Really not using this style,I am using store procedure Below run application ID column is requierd present error
public FileResult Download(int id)
{
var parameter = new SqlParameter("@Id", id);
var Getfilename = _context.REHPData.FromSql("EXEC FileDownloadProcedure @Id", parameter).Single();
var filepath = Path.Combine(_environment.WebRootPath, "UploadFiles", filename.ToString());
return File(filepath, "application/pdf");
}
Please help me and code errror.
My sql StoreProcedure look like this :
CREATE PROCEDURE [dbo].[FileDownloadProcedure]
@param1 int
AS
SELECT UploadFilePath FROM DBO.REHPData WHERE ID= @param1
RETURN 0
Reply
Answers (
2
)
How Login From Mobile Number In Mvc using AccountController
calcualte diskspace performance physicalmemory usage histroy