上传和下载的问题 我需要把当前上传的文件插到数据库的某个字段里下载的时候也是从数据库里下载数据库是oracle10g,请问大家有什么办法该如何实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果需要存到数据库里参考http://blog.163.com/8405888/blog/static/12799222009874283047/ 读出数据,输出相关类型如Response.AppendHeader("Content-Disposition","attachment;filename="+File+"");Response.ContentType ="application/octet-stream""; Response.WriteFile("");Response.End(); 我用Sqlservr做过此类东东,放到数据库里,一般存放形式的都是二进制,那你就用从流内读成byte[]再放数据库吧,读也用byte[]从数据库中读出再写入流中最后发给客户端 存的时候把文件名如 text.Doc 保存(列:filename)起来,再把文件转成二进制存在 Blob字段(列:fj)中下载的时候 string filename=myset.Tables[0].Rows[0]["fjmc"].ToString().Trim();byte[] myfile=new byte[j]; myfile=(byte[])myset.Tables[0].Rows[0]["fj"]; this.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(""+filename+"")); Response.BinaryWrite(myfile); Response.End(); 【求救】如何替换控件? 多條件查詢問題 gridview里面的checkbox怎么绑定数据 一个文字对比 算结果的问题 怎样把DataView中的某几个字段过滤出来? e.Item.FindControl("控件ID")里面的控件ID如何得知?(DataGrid数据更新里面的问题) 不使用邮件服务器如何自动发送注册信息邮件? 散份问题,请不要删啊! 关于password密码域显示的问题 形如WebForm1.aspx.cs的文件有何用,事件代码或其他代码用c#写在.aspx的文件中还是写在.aspx.cs的文件中 一种网页效果 为什么页面一加上Ajax就出错
参考
http://blog.163.com/8405888/blog/static/12799222009874283047/
读出数据,输出相关类型如
Response.AppendHeader("Content-Disposition","attachment;filename="+File+"");
Response.ContentType ="application/octet-stream"";
Response.WriteFile("");
Response.End();
byte[] myfile=new byte[j];
myfile=(byte[])myset.Tables[0].Rows[0]["fj"]; this.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(""+filename+""));
Response.BinaryWrite(myfile);
Response.End();