我现在有好多的文件可以下载,有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");
后面那个也是需要文件类型,请问如何解决这个问题,谢谢
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");
后面那个也是需要文件类型,请问如何解决这个问题,谢谢
解决方案 »
- 高手来觖决 =====在IIS中浏览就出错说是CS0246: 找不到类型或命名空间名称“myLib”(是否缺少 using 指令或程序集引用?) ======在线等
- 关于新浪微博的POST注册,求高人指点
- gridview中的checkbox
- 有个JS问题
- gridview中自定义编辑按钮,如何实现编辑单元格功能
- Ajax ModalPopup 问题
- 如何实现用checkbox控制页面的内容?
- (asp.net初学者)ms sql的链接语句该怎么写
- SqlDataAdapter.Fill(dsReapter,5000,6000,myTable);中的5000和6000是什么意思啊
- 怎么修改DataGrid编辑状态中的那些TextBox的宽度?头痛 :(
- mvc displayFor换行的问题
- 使用Aspose.Words组件
"application/x-zip-compressed"
应该就可以了