Reputation: 1021
I just want to download a file. But now I can only download images.
I have this:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult DownloadFile(DownloadFileModel model, string fileName, int fileId)
{
//var extension = Path.GetExtension(model.FileName).TrimStart('.');
//var extensies = Seneca.SfsLib.FileSystemHelper.UploadOptInExtensions.Contains(extension);
string customerSchema = SfsHelpers.StateHelper.GetSchema();
TemplateLibraryEntry entry = GetTemplateLibraryEntry(model.DesignId, customerSchema);
FileTree tree = CreateTree(model.DesignId, entry.FilePath);
FileInfo fileInfo = new FileInfo(tree.Files[fileId].FullPath);
DirectoryInfo directoryInfo = new DirectoryInfo(tree.Files[fileId].FullPath);
try {
var fs = System.IO.File.OpenRead(fileInfo + model.FileName );
return File(fs, "application/jpg", fileName);
}
catch {
throw new HttpException(404, "Couldn't find " + model.FileName);
}
}
But If I download a file now, I see every time downloadfile. I mean I dont see the fil name and extensie
thank you
Upvotes: 4
Views: 4271