Click here to Skip to main content
15,390,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am unable to download a file in core. i try some codes but it's not work for me and also i don't get error in my code. can any one suggest me the solution.

What I have tried:

public FileStreamResult Download()
    string filename = "test.pdf";
    string filepath = _hostingEnvironment.WebRootPath + "\\Doc\\download";
    string fullName = Path.Combine(filepath, filename);
    return File(new FileStream(fullName, FileMode.Open), "application/pdf", filename);
Updated 4-Aug-20 21:05pm

1 solution

Here, refer to this home grown article of CP: How to Upload a Document in ASP.NET Core[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900