- //读取文件输出它
- string strFile = "c://abc.doc";
- FileStream fs = new FileStream(strFile, FileMode.Open);
- byte[] bytes = new byte[(int)fs.Length];
- fs.Read(bytes, 0, bytes.Length);
- fs.Close();
- Response.ContentType = "application/octet-stream";
- Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(File.Name));
- Response.BinaryWrite(bytes);
- Response.End();
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索bytes
, byte
, response
, filestream
, length
, 输入框不屏蔽
Content-Disposition
,以便于您获取更多的相关知识。
时间: 2024-10-24 18:04:27