c# - 文件流下载-自定义工具
//需要文件字节流、带后缀的文件名,mine类型
public static void exportFile(byte[] data, string fileName, string mine) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Charset = "utf-8"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); HttpContext.Current.Response.ContentType = mine; HttpContext.Current.Response.BinaryWrite(data); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); }
本文来自博客园,作者:岑惜,转载请注明原文链接:https://www.cnblogs.com/c2g5201314/p/17198180.html
响应开源精神相互学习,内容良币驱除劣币

浙公网安备 33010602011771号