I'm currently trying to implement a controller where you can upload files (more specifically, jar archives). Files are stored on disk, not in the database. So far I have come up with the following:
public FilePathResult GetFile(String fileName) { return File(Path.Combine(Server.MapPath("~/App_Data/Bundles"), fileName), "application/java-archive"); }
Ignore the lack of error handling and the like. The file is loaded this way, but it gets the wrong name. Instead, for example, the "sample.jar" file gets the controller name "GetFile" (without the extension).
Any ideas on what I'm doing wrong?
source share