求助:批量下载服务器上指定文件夹下的文件 实现功能:将员工照片(已经上传到服务器)批量下载到客户端一个指定的文件夹下。要求:1、不要将文件压缩成(.rar或者.zip)文件 2、最好没有下载提示(相当于将数据导出到本地,有下载提示比较恶心)最好有代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这不就是迅雷批量下载吗,下载类型是*.jpg之类的。 ftpwebrequest下载文件用程序根据遍历的结果生成一个.zip文件 遍历文件夹public static void DownLoadFile( string filepath ) { string str = HttpContext.Current.Request.ServerVariables[ "APPL_PHYSICAL_PATH" ]; string path = str + filepath; FileInfo file = new FileInfo( path ); HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding( "UTF-8" ); //解决中文乱码 HttpContext.Current.Response.AddHeader( "Content-Disposition", "attachment; filename=" + HttpContext.Current.Server.UrlEncode( file.Name ) ); //解决中文文件名乱码 HttpContext.Current.Response.AddHeader( "Content-length", file.Length.ToString() ); HttpContext.Current.Response.ContentType = "appliction/octet-stream"; HttpContext.Current.Response.WriteFile( file.FullName ); HttpContext.Current.Response.End(); } 请高手指点 新闻发布页的链接 问一个关于url rewrite的效率速度问题 从子页面向父页面传值问题 .net数据结构 线性表 存储数据 优化索引 实际例子 使用split分离字符串是出现的问题 问个比较菜的问题:Response类为什么不能继承? 这样的功能我一定要做成两个页面吗? 如何获得网页代码?在线等!!!! webpack +asp.net mvc 发布操作 哪位大侠帮忙看看,Global.asax.cs中Request.Url.Segments[1].ToLower()的问题 gridview手动添加列以后,如何将数据放入新添加列?
用程序根据遍历的结果生成一个.zip文件
public static void DownLoadFile( string filepath )
{
string str = HttpContext.Current.Request.ServerVariables[ "APPL_PHYSICAL_PATH" ];
string path = str + filepath;
FileInfo file = new FileInfo( path );
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding( "UTF-8" ); //解决中文乱码
HttpContext.Current.Response.AddHeader( "Content-Disposition", "attachment; filename=" + HttpContext.Current.Server.UrlEncode( file.Name ) ); //解决中文文件名乱码
HttpContext.Current.Response.AddHeader( "Content-length", file.Length.ToString() );
HttpContext.Current.Response.ContentType = "appliction/octet-stream";
HttpContext.Current.Response.WriteFile( file.FullName );
HttpContext.Current.Response.End();
}