类似这种的
word ,txt,excel 之类的 可以点击下载
完成后另赠200分
9 个解决方案
#1
怎么没人看 啊
#2
用fso ,Files 遍历目录,找个或自己写个可以分步加载的树就行了
先生成一级目录,展开目录时,异步取展开,下载就是个路径转URL连接
先生成一级目录,展开目录时,异步取展开,下载就是个路径转URL连接
#3
直接找个ASP系统参考就是了嘛……
好多后台功能有这个……
好多后台功能有这个……
#4
高端!
搬个小凳子学。
搬个小凳子学。
#5
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Option Explicit
Response.CodePage=65001
Response.Charset="UTF-8"
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"
Dim file_url,fso,s_path,arr_ext,i_folder
s_path=Server.MapPath("/FUploadFile") '定义目录树
arr_ext="txt,doc,jpg" '定义可下载文件的类型
'*************************************************
'作 用:本程序的作用是直接下载文件而不是在IE中打开,如htm、txt、asp、jpg文件等
'*************************************************
file_url=Request.QueryString("file")
If file_url<>"" Then
'on error resume Next
Dim Scs,ture_url,filename,exe_name,Range,file_name
ture_url=server.MapPath(file_url)
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(ture_url) Then
Response.write "<script>alert('对不起,文件不存在!');window.opener=null;window.open('','_self');window.close();</script>"
Response.End
ElseIf InStr(LCase(ture_url),LCase(s_path)) Then '安全起见,限制只能下载指定目录文件
file_name=Mid(ture_url,instrRev(ture_url,"\")+1) '文件名含后缀
exe_name=Mid(file_name,instrRev(file_name,".")+1)'后缀名
filename=Mid(file_name,1,instrRev(file_name,".")-1)'文件名
Set Scs=CreateObject("Adodb.Stream")
Scs.Mode=3
Scs.Type=1
Scs.Open
Scs.LoadFromFile(ture_url)
If InStr(arr_ext,exe_name)>0 Then
Response.ContentType="application/octet-stream"
If Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE")>0 Then filename=Server.URLEncode(filename)
Response.AddHeader "Content-Disposition:","Attachment;filename="&filename&"."&exe_name
Range=Mid(Request.ServerVariables("HTTP_RANGE"),7)
If Range="" Then
Response.BinaryWrite(Scs.Read)
Else
Scs.Postion=Clng(Split(Range,"-")(0))
Response.BinaryWrite(Scs.Read)
End If
Else
Response.write "<script>alert('对不起,本文件禁止下载');window.opener=null;window.open('','_self');window.close();</script>"
Response.End
End If
Else
Response.write "<script>alert('对不起,你访问了禁区文件!');window.opener=null;window.open('','_self');window.close();</script>"
Response.End
End If
End if
'*************************************************
'作 用:回调函数,生成z-tree数据
'*************************************************
Sub sub_file(TruePath,pid)
Dim fso,theFolder,File,Folder,i,this_id
If pid<>"0" Then Response.write ","
this_id=i_folder+1
Response.write "{id:"""&this_id&""", pId:"&pid&",name:"""&Mid(TruePath,instrRev(TruePath,"\")+1)&"""}"
i_folder=i_folder+1
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFolder=fso.GetFolder(TruePath)
i=1
For Each File In theFolder.Files
i=i+1
Response.write ",{id:"""&pid&"_"&i&""", pId:"""&this_id&""",name:"""&Mid(File,instrRev(File,"\")+1)&" ["&File.Size&"KB]"",url:""?file="&Replace(Replace(File,s_path,"/FUploadFile"),"\","/")&"""}"
Next
For Each Folder In theFolder.subfolders
Call sub_file(Folder,this_id)
Next
Set fso = Nothing
End Sub
%><!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<TITLE> FSO 生成目录树 scscms</TITLE>
<link rel="stylesheet" href="zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="zTreeStyle/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="zTreeStyle/jquery.ztree.all-3.5.min.js"></script>
<script>
var zNodes =[<%Call sub_file(s_path,"0")%>];
var setting = {data: {simpleData: {enable: true}}}
$(document).ready(function(){
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
});
</script>
</head>
<body>
<h2>上传目录浏览</h2>
<ul id="treeDemo" class="ztree"></ul>
</body>
</html>
文件下载: http://www.scscms.com/html/article/20130823-fso-folder-tree.html
#6
有些js tree,改写一下成为asp代码就行。
#7
http://www.jstree.com/
看看这个。
看看这个。
#8
这次平分了 完了给你转200
#9
必须支持一个,感谢论坛提供这样的机会,学习一下
#1
怎么没人看 啊
#2
用fso ,Files 遍历目录,找个或自己写个可以分步加载的树就行了
先生成一级目录,展开目录时,异步取展开,下载就是个路径转URL连接
先生成一级目录,展开目录时,异步取展开,下载就是个路径转URL连接
#3
直接找个ASP系统参考就是了嘛……
好多后台功能有这个……
好多后台功能有这个……
#4
高端!
搬个小凳子学。
搬个小凳子学。
#5
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Option Explicit
Response.CodePage=65001
Response.Charset="UTF-8"
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"
Dim file_url,fso,s_path,arr_ext,i_folder
s_path=Server.MapPath("/FUploadFile") '定义目录树
arr_ext="txt,doc,jpg" '定义可下载文件的类型
'*************************************************
'作 用:本程序的作用是直接下载文件而不是在IE中打开,如htm、txt、asp、jpg文件等
'*************************************************
file_url=Request.QueryString("file")
If file_url<>"" Then
'on error resume Next
Dim Scs,ture_url,filename,exe_name,Range,file_name
ture_url=server.MapPath(file_url)
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(ture_url) Then
Response.write "<script>alert('对不起,文件不存在!');window.opener=null;window.open('','_self');window.close();</script>"
Response.End
ElseIf InStr(LCase(ture_url),LCase(s_path)) Then '安全起见,限制只能下载指定目录文件
file_name=Mid(ture_url,instrRev(ture_url,"\")+1) '文件名含后缀
exe_name=Mid(file_name,instrRev(file_name,".")+1)'后缀名
filename=Mid(file_name,1,instrRev(file_name,".")-1)'文件名
Set Scs=CreateObject("Adodb.Stream")
Scs.Mode=3
Scs.Type=1
Scs.Open
Scs.LoadFromFile(ture_url)
If InStr(arr_ext,exe_name)>0 Then
Response.ContentType="application/octet-stream"
If Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE")>0 Then filename=Server.URLEncode(filename)
Response.AddHeader "Content-Disposition:","Attachment;filename="&filename&"."&exe_name
Range=Mid(Request.ServerVariables("HTTP_RANGE"),7)
If Range="" Then
Response.BinaryWrite(Scs.Read)
Else
Scs.Postion=Clng(Split(Range,"-")(0))
Response.BinaryWrite(Scs.Read)
End If
Else
Response.write "<script>alert('对不起,本文件禁止下载');window.opener=null;window.open('','_self');window.close();</script>"
Response.End
End If
Else
Response.write "<script>alert('对不起,你访问了禁区文件!');window.opener=null;window.open('','_self');window.close();</script>"
Response.End
End If
End if
'*************************************************
'作 用:回调函数,生成z-tree数据
'*************************************************
Sub sub_file(TruePath,pid)
Dim fso,theFolder,File,Folder,i,this_id
If pid<>"0" Then Response.write ","
this_id=i_folder+1
Response.write "{id:"""&this_id&""", pId:"&pid&",name:"""&Mid(TruePath,instrRev(TruePath,"\")+1)&"""}"
i_folder=i_folder+1
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFolder=fso.GetFolder(TruePath)
i=1
For Each File In theFolder.Files
i=i+1
Response.write ",{id:"""&pid&"_"&i&""", pId:"""&this_id&""",name:"""&Mid(File,instrRev(File,"\")+1)&" ["&File.Size&"KB]"",url:""?file="&Replace(Replace(File,s_path,"/FUploadFile"),"\","/")&"""}"
Next
For Each Folder In theFolder.subfolders
Call sub_file(Folder,this_id)
Next
Set fso = Nothing
End Sub
%><!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<TITLE> FSO 生成目录树 scscms</TITLE>
<link rel="stylesheet" href="zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="zTreeStyle/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="zTreeStyle/jquery.ztree.all-3.5.min.js"></script>
<script>
var zNodes =[<%Call sub_file(s_path,"0")%>];
var setting = {data: {simpleData: {enable: true}}}
$(document).ready(function(){
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
});
</script>
</head>
<body>
<h2>上传目录浏览</h2>
<ul id="treeDemo" class="ztree"></ul>
</body>
</html>
文件下载: http://www.scscms.com/html/article/20130823-fso-folder-tree.html
#6
有些js tree,改写一下成为asp代码就行。
#7
http://www.jstree.com/
看看这个。
看看这个。
#8
这次平分了 完了给你转200
#9
必须支持一个,感谢论坛提供这样的机会,学习一下