Response.AddHeader("Content-Disposition", "attachmentfilename=\"" +filename+ "\"")
download.aspxstring fileName = ""//客户端保存的文件名
string filePath = Server.MapPath("")//路径
FileInfo fileInfo = new FileInfo(filePath)
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.AddHeader("Content-Disposition", "attachmentfilename=" + fileName)
Response.AddHeader("Content-Length", fileInfo.Length.ToString())
Response.AddHeader("Content-Transfer-Encoding", "binary")
Response.ContentType = "application/octet-stream"
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312")
Response.WriteFile(fileInfo.FullName)
Response.Flush()
Response.End()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)