111,126
社区成员
发帖
与我相关
我的任务
分享
string path = Server.MapPath(fileInfo_Path);
FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
byte[] MyData = new byte[fileStream.Length];
fileStream.Read(MyData, 0, System.Convert.ToInt32(fileStream.Length));
fileStream.Close();
this.Response.Clear();
this.Response.ClearHeaders();
this.Response.Buffer = true;
this.Response.ContentType = contentType;
this.Response.Expires = -1;
this.Response.AppendHeader("Content-Language", "zh");
this.Response.AppendHeader("Content-Disposition", "inline;filename=" + HttpUtility.UrlEncode(file_name, System.Text.Encoding.UTF8));
Response.ContentEncoding = System.Text.Encoding.Default;
this.Response.BinaryWrite(MyData);
this.Response.Flush();
this.Response.End();
string path = Server.MapPath(fileInfo_Path);
FileInfo DownloadFile = new FileInfo(path);
this.Response.Clear();
this.Response.ClearHeaders();
this.Response.Buffer = true;
this.Response.ContentType = contentType;
this.Response.Expires = -1;
this.Response.AppendHeader("Content-Language", "zh");
this.Response.AppendHeader("Content-Disposition", "inline;filename=" + HttpUtility.UrlEncode(file_name, System.Text.Encoding.UTF8));
Response.ContentEncoding = System.Text.Encoding.Default;
this.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
this.Response.WriteFile(DownloadFile.FullName);
this.Response.Flush();
this.Response.End();