日期:2014-05-18  浏览次数:20987 次

jQuery FileTree 如何读取服务器目录
root: 'UploadFile/',
 script: 'jqueryFileTree.aspx',

root是读取本地计算机目录,那怎么读取服务器目录呢?

本人新手,请指教。

------解决方案--------------------
通过ajax get 传值到ashx,aspx等获取服务器目录
通过json 等实现数据传递
点击节点,在下载页面
string fileName = "";//客户端保存的文件名
string filePath = Server.MapPath("");//路径

FileInfo fileInfo = new FileInfo(filePath);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(fileInfo.FullName);
Response.Flush();
Response.End();