-2
protected void getFileAttachment(byte[] bytes)
{
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = fileType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + "test101");
Response.OutputStream.Write(bytes,0,bytes.Length);
Response.BinaryWrite(bytes);
Response.Flush();
}
我想转换被保存在SQL Server VARBINARY和我有麻烦,因为输出文件没有扩展二进制文件下载 - 但下载的文件没有文件扩展名?
你的Content-Disposition标题有一个没有扩展名的文件名 - 如果你希望有一个扩展名,就添加一个。 – jdphenix
您并未添加扩展程序。你期望它来自哪里? –
谢谢,这是我的错,我没有注意到。谢谢帕尔! –