Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class FileController : Controller
public async Task<IActionResult> Download(Guid id)
// Grab a test.pdf back one directory. Look ma - it even runs on Linux with Path.DirectorySeparatorChar!
var fileContent = await File.ReadAllBytesAsync($"..{Path.DirectorySeparatorChar}test.pdf");
return File(fileContent, "application/pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment