:: :: 博问 :: 闪存 :: :: 联系 :: :: 管理 ::
                    String StrName = System.IO.Path.GetFileName(TObj.ClientFilePath);
                    String StrPath 
= MapPath(Request.ApplicationPath + TObj.VirtualFilePath);

                    FileStream fileStream
=new FileStream(StrPath, FileMode.Open); 
                    
long fileSize = fileStream.Length; 
                    Context.Response.ContentType
="application/octet-steam"
                    Context.Response.AddHeader(
"Content-Disposition","attachment; filename=\"" + HttpUtility.UrlEncode(StrName, System.Text.Encoding.UTF8) + "\";"); 
                    Context.Response.AddHeader(
"Content-Length",fileSize.ToString()); 
                    
byte[] fileBuffer=new byte[fileSize]; 
                    fileStream.Read(fileBuffer, 
0, (int)fileSize); 
                    Context.Response.BinaryWrite(fileBuffer); 
                    Context.Response.End(); 
posted on 2006-02-08 17:24  dtor  阅读(253)  评论(0编辑  收藏  举报