Hello Team, Please how do I download uploaded document in my MVC Project
How do I download uploaded document
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Hello Team, Please how do I download uploaded document in my MVC Project
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal JoshiRank #377 · 6.7K reputationPosted Mar 5, 2024, 12:29 AM EST
Hello Emmanuel
Please check out the below code to download the uploaded document.
C# Controller Code
public FileResult Download(string fileName) { string _path = Path.Combine(Server.MapPath("~/UploadedFiles"), fileName); return File(_path, "application/force-download", Path.GetFileName(_path)); }View/HTML Code:
@foreach (var item in Model){ var downloadUrl = string.Format("Download?fileName={0}",@Uri.EscapeDataString(item.ToString()));}Thanks
Vishal
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 5, 2024, 12:55 AM EST
Hello Emmmanuel,
Please refer to this article for upload and download in MVC,
https://www.c-sharpcorner.com/UploadFile/65794e/uploading-and-downloading-in-mvc/
Emmmanuel FIADUFERank #947 · 2.2K reputationPosted Mar 5, 2024, 2:31 AM EST
Thank you team, it is working now