日期:2014-05-20  浏览次数:20497 次

上午发贴的问题,没有解决,继续问,来者有分
是关于“多附件下载”的,我数据库字段   "多附件上传地址 "   中形式是   :
  A:/aaa;B:/bbb;C:/ccc;

下载页面:
下载的时候,先定義一個字符串數組,把分號之間的路径取出來存進數組,然後用一個循環輸出,在循環中调用下载函数如:FileDownload(),这样做可以吗?或者大哥们再提供一个思路。谢谢

private   void   FileDownload(string   filepath)
        {
                FileInfo   DownloadFile   =   new   FileInfo(filepath);
                Response.Clear();
                Response.ClearHeaders();
                Response.Buffer   =   false;
                Response.ContentType   =   "application/octet-stream ";
                Response.AppendHeader( "Content-Disposition ",   "attachment;filename= "   +   HttpUtility.UrlEncode(DownloadFile.FullName,   System.Text.Encoding.UTF8));
                Response.AppendHeader( "Content-Length ",   DownloadFile.Length.ToString());
                Response.WriteFile(DownloadFile.FullName);
                Response.Flush();
                Response.End();



------解决方案--------------------
sofa 不懂,下面的解決.
------解决方案--------------------
慕名而来
------解决方案--------------------
帮顶!
------解决方案--------------------
帮顶!

------解决方案--------------------
foreach(stirng filepath in "A:/aaa;B:/bbb;C:/ccc ".Split( "; "))
{

}


------解决方案--------------------
确切的说,是一次request只能下载一个文件

或者,你用zip把文件打个包吧:P
------解决方案--------------------
Down.aspx: string sPath = Request.QueryString[ "Path "]; if(sPath == null) return ; strring sLocalPath = Server.Mappath(sPath); if(!System.IO.File.Exists(sLocalPath )) { return; } Response.WriteFile(sLocalPath ); Response.End();
------解决方案--------------------
up
------解决方案--------------------
你的Down.aspx页
private void Page_Load(object sender, System.EventArgs e)
{
if(!string.IsNullOrEmpty(Request[ "url "]))//传递的参数不为null和空时
{
……你的下载代码
//如果下载成功,最后再执行一个写页面的动作
HttpContext.Current.Response.Write( "Down Succeed! ");

// 向客户端发出当前所有缓冲的输出
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
}
------解决方案--------------------

------解决方案--------------------
请问为什么我发的贴不会在http://topic.csdn.net/这个页面上呀??