WEB 文件下载求教 如何不保存文件到服务器 直接实现读取流下载到浏览器客户端
System.Data.OleDb.OleDbDataReader dr = null;System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();
byte[] FileData=null;
string type="";
cmd.CommandText = "select * from FL_FILES where FL_ID=3";
cmd.Parameters.Add(new System.Data.OleDb.OleDbParameter("@FL_ID", System.Data.OleDb.OleDbType.Integer)).Value = TextBox1.Text.Trim();
cmd.Connection = conn;
conn.Open();
dr = cmd.ExecuteReader();
if (dr.Read())
{
FileData = (byte[])dr["FL_DATA"];
type=dr["FL_IMETYPE"].ToString();
}
dr.Close();
conn.Close();
//string fileName="d:\\aaa"+type;
System.IO.FileStream fs = new System.IO.FileStream("d:\\IIS[3]\\CMS\\DOWNLOADS\\aaa"+type, System.IO.FileMode.Create);
System.IO.BinaryWriter bw = new System.IO.BinaryWriter(fs);
bw.Write(FileData, 0, FileData.Length);
bw.Close();
如何不保存文件到服务器 直接实现读取流下载到浏览器客户端 --------------------编程问答-------------------- 用Response.BinaryWrite方法 --------------------编程问答-------------------- 有实例看看吗?
补充:.NET技术 , C#