【分不够一个字加 ,超级大问题】
用.net开发pda程序下载文件
SqlCommand CmdObj = new SqlCommand(strSql,con);
CmdObj.Parameters.Add("@FileID", SqlDbType.Int).Value=fileid;
con.Open();
SqlDataReader SqlReader = CmdObj.ExecuteReader();
SqlReader.Read();
Response.ContentType= (string)SqlReader["contenttype"];//设定输出文件类型
//输出图象文件二进制数制
Response.AppendHeader("Content-Disposition:", "attachment; filename=" + HttpUtility.UrlEncode((string)SqlReader["filename"]));
//Response.AppendHeader("Content-Disposition:", "attachment; filename=" +((string)SqlReader["filename"]));
Response.OutputStream.Write((byte[])SqlReader["filedata"], 0, (int)SqlReader["filesize"]);
Response.End();
con.Close();
下载的文件名变成了当前的超连接
例子
http://localhost/default.aspx
下载的文件名变成了default.aspx且文件名后缀不能改
精简版也精简的太厉害了
还请大家帮忙,谢谢啦