首页 > 代码库 > 转换成流字节,输出浏览器下载

转换成流字节,输出浏览器下载

//转换成流字节,输出浏览器下载
var byti = file.SaveToStream().GetBuffer();
////通知浏览器保存文件,其实也就是输出到浏览器
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
Response.BinaryWrite(byti);
Response.Flush();
Response.Close();

转换成流字节,输出浏览器下载