c# - Download file from ASP.NET MVC 2 site -
i'm trying implement controller can download files (more jar-archives). files stored on disk , not in database. far have come this:
public filepathresult getfile(string filename) { return file(path.combine(server.mappath("~/app_data/bundles"), filename), "application/java-archive"); }
nevermind lack of error handling , such @ time. file downloaded way, gets wrong name. instead of, example, "sample.jar" file gets controller's name, "getfile", (without extension).
any ideas on doing wrong?
use overload allows specify filedownloadname
.
return file(path.combine(server.mappath("~/app_data/bundles"), filename), "application/java-archive", filename);
Comments
Post a Comment