MVC 文件动态下载,文件类型如何指定?谢谢
我现在有好多的文件可以下载,有rar打包的,有txt或者excel,MVC的文件下载方法
string path = AppDomain.CurrentDomain.BaseDirectory + "uploads/";
string fileName = "test.txt";
return File(new FileStream(path + fileName, FileMode.Open), "text/plain", fileName);
"text/plain", 是文件的类型,请问我如何可以动态设置这个参数,我试过用return File(path, "application/x-zip-compressed");
后面那个也是需要文件类型,请问如何解决这个问题,谢谢