欢迎光临
我们一直在努力

WEB文件管理器2.0版-ASP教程,ASP应用

建站超值云服务器,限时71元/月

<title>web文件管理器2.0版 http://asp2004.net</title>
<meta http-equiv=”content-type” content=”text/html; charset=gb2312″>
<style type=”text/css”>
<!–
a {
 font-size: 9pt;
 color: #3300cc;
 text-decoration: none;
}
body {
 font-size: 9pt;
 margin-left: 0px;
 margin-top: 0px;
 margin-right: 0px;
 margin-bottom: 0px;
 line-height: 20px;
 background-color: #eeeeee;
}
td {
 font-size: 9pt;
 line-height: 20px;
}
.tx {
 border-color:#000000;
 border-left-width: 0px;
 border-top-width: 0px;
 border-right-width: 0px;
 border-bottom-width: 1px;
 font-size: 9pt;
 background-color: #eeeeee;
}
.tx1 {
 font-size: 9pt;
 border: 1px solid;
 border-color:#000000;
 color: #000000;
}
–>
</style>
<%
’版权声明:本代码仅供学习研究之用,本人不对因使用本程序而造成的任何后果负责。未经作者书面许可不得用于商业用途。
’qq:103895
’email:quxiaohui_0@163.com
’http://asp2004.net
server.scripttimeout = 999
action = request(“action”)
temp = split(request.servervariables(“url”), “/”)
url = temp(ubound(temp))
const pass = “asp2004.net”’登陆密码
’登陆验证
call chklogin()
set fso = createobject(“scripting.filesystemobject”)
select case action
    case “新建文件”
        call fileform(request(“path”)&”\”)
    case “savefile”
        call savefile(request(“filename”), request(“content”), request(“filename1”))
    case “新建文件夹”
        call newfolder(request(“path”)&”\”)
    case “savefolder”
        call savefolder(request(“foldername”))
    case “编辑”
        call edit(request(“f”))
    case “重命名”
        call renameform(request(“f”))
    case “saverename”
        call rename(request(“oldname”), request(“newname”))
    case “剪切”
        session(“f”) = request(“f”)
        session(“action”) = action
        response.redirect(url&”?foldername=”&request(“path”))
    case “复制”
        session(“f”) = request(“f”)
        session(“action”) = action
        response.redirect(url&”?foldername=”&request(“path”))
    case “粘贴”
        call affix(request(“path”)&”\”)
    case “删除”
        call delete( request(“f”), request(“path”) )
    case “uploadform”
        call uploadform(request(“filepath”), request(“path”))
    case “saveupload”
        call saveupload()
    case “下载”
        call download(request(“f”))
    case “打包”
        dim str, s, s1, s2, rep
        call dabao( request(“f”), request(“path”) )
    case “解包”
        call jiebao(request(“f”), request(“path”))
    case “退出”
        call logout()
    case else
        path = request(“foldername”)
        if path = “” then path = server.mappath(“./”)
        showfolderlist(path)
end select
set fso = nothing
’列出文件和文件夹
function showfolderlist(folderspec)
    temp = request.servervariables(“http_referer”)
    temp = left(temp, instrrev(temp, “/”))
    temp1 = len(folderspec) – len(server.mappath(“./”)) -1
    if temp1>0 then
        temp1 = right(folderspec, cint(temp1)) + “\”
    elseif temp1 = -1 then
        temp1 = “”
    end if
    tempurl = temp + replace(temp1, “\”, “/”)
    uppath = “./” + replace(temp1, “\”, “/”)
    upfolderspec = fso.getparentfoldername(folderspec&”\”)
    set f = fso.getfolder(folderspec)
%>
<form name=”form1″ method=post action=””>
<input type=”hidden” name=”path” class=”tx1″ value=”<%= folderspec%>”>
<input type=”submit” name=”action” class=”tx1″ value=”新建文件夹”>
<input type=”submit” name=”action” class=”tx1″ value=”新建文件”>
<input type=”button” value=”向上” class=”tx1″ onclick=”location.href=’<%= url%>?foldername=<%= replace(upfolderspec,”\”,”\\”)%>’”>
<input type=”button” value=”返回” class=”tx1″ onclick=”location.href=’<%= url%>’”>
<input type=”submit” name=”action” class=”tx1″ value=”重命名”>
<input type=”submit” name=”action” class=”tx1″ value=”编辑”>
<input type=”submit” name=”action” class=”tx1″ value=”剪切”>
<input type=”submit” name=”action” class=”tx1″ value=”复制”>
<input type=”submit” name=”action” class=”tx1″ value=”粘贴” onclick=”return confirm(’确认粘贴吗?’);” <%if session(“f”)=”” or isnull(session(“f”)) then response.write(” disabled”) %>>
<input type=”submit” name=”action” class=”tx1″ value=”删除” onclick=”return confirm(’确认删除吗?’);”>
<input type=”button” name=”action” class=”tx1″ value=”上传” onclick=”javascript:window.open(’<%= url%>?action=uploadform&filepath=<%= uppath%>&path=<%= replace(folderspec,”\”,”\\”)%>’,’new_page’,’width=600,height=260,left=100,top=100,scrollbars=auto’);return false;”>
<input type=”submit” name=”action” class=”tx1″ value=”下载”>
<input type=”submit” name=”action” class=”tx1″ value=”打包” onclick=”return confirm(’确认打包吗?’);”>
<input type=”submit” name=”action” class=”tx1″ value=”解包” onclick=”return confirm(’确认解包吗?’);”>
<input type=”submit” name=”action” class=”tx1″ value=”退出” onclick=”return confirm(’确认退出吗?’);”>
<br>当前目录:<%=f.path%>当前时间:<%=now%>
<table width=”100%” height=”24″ border=”1″ cellpadding=”0″ cellspacing=”0″ bordercolor=”#ffffff” bordercolorlight=”#ffffff” bordercolordark=”#000000″>
  <tr bgcolor=”#cccccc”>
    <td width=”4%” align=”center”>操作<input type=”checkbox” name=”chkall” onclick=”for (var i=0;i<form1.elements.length;i++){var e = form1.elements[i];if (e.type == ’checkbox’)e.checked = form1.chkall.checked;}”></td>
    <td width=”42%” align=”center”>名称</td>
    <td width=”11%” align=”right”>大小<%= formatnumber(f.size/1024,2)%>k</td>
    <td width=”20%” align=”center”>类型</td>
    <td width=”13%”>修改时间</td>
    <td width=”10%”>属性</td>
  </tr>
<%
’列出目录
set fc = f.subfolders
for each f1 in fc
%>
  <tr bgcolor=”#eeeeee” onmouseover=this.bgcolor=’#f3f6fa’; onmouseout=this.bgcolor=’#eeeeee’;>
    <td><center><input type=”checkbox” name=”f” value=”<%= folderspec&”\”&f1.name%>”></center></td>
    <td><a href=”<%= url%>?foldername=<%= folderspec%>\<%= f1.name%>”><%= f1.name%></a></td>
    <td align=”right”><%= f1.size%></td>
    <td><%= f1.type%></td>
    <td><%= f1.datelastmodified%></td>
    <td><%= f1.attributes%></td>
  </tr>
<%
next
’列出文件
set fc = f.files
for each f1 in fc
%>
  <tr bgcolor=”#efefef” onmouseover=this.bgcolor=’#f3f6fa’; onmouseout=this.bgcolor=’#eeeeee’;>
    <td><center><input type=”checkbox” name=”f” value=”<%= folderspec&”\”&f1.name%>”></center></td>
    <td><a href=”<%= tempurl+f1.name%>” target=”_blank”><%= f1.name%></a></td>
    <td align=”right”><%= f1.size%></td>
    <td><%= f1.type%></td>
    <td><%= f1.datelastmodified%></td>
    <td><%= f1.attributes%></td>
  </tr>
<%
next
%>
</table>
</form>
<%
end function
’保存文件
function savefile(filename, content, filename1)
    if request.servervariables(“path_translated”)<>filename then
        set f1 = fso.opentextfile(filename, 2, true)
        f1.write(content)
        f1.close
    end if
    response.redirect(url&”?foldername=”&fso.getparentfoldername(filename))
end function
’文件表单
function fileform(filename)
    if fso.fileexists(filename) then
        set f1 = fso.opentextfile(filename, 1, true)
        content = server.htmlencode(f1.readall)
        f1.close
    end if
%>
<form name=”form1″ method=”post” action=”<%= url%>?action=savefile”>
<center><input name=”filename” type=”text” class=”tx” style=”width:100%” value=”<%= filename%>”><textarea name=”content” wrap=”virtual” class=”tx” style=”width:100%;height:100%;font:arial,helvetica,sans-serif;” onkeyup=”style.height=this.scrollheight;”><%= content%></textarea><input type=”submit” class=”tx1″ onclick=”return confirm(’保存 ’+filename.value+’ ?’);” value=”保存”><input type=”reset” class=”tx1″ value=”重置”></center>
</form>
<%
end function
’保存文件夹
function savefolder(foldername)
    set f = fso.createfolder(foldername)
    response.redirect(url&”?foldername=”&f)
end function
’新文件夹
function newfolder(foldername)
    folderform foldername
end function
’文件夹表单
function folderform(foldername)
%>
<form method=”post” action=”<%= url%>?action=savefolder”>
<center><input name=”foldername” type=”text” size=”100″ value=”<%= foldername%>”><input type=”submit” class=”tx1″ onclick=”return confirm(’保存 ’+foldername.value+’ ?’);” value=”保存”><input type=”reset” class=”tx1″ value=”重置”></center>
</form>
<%
end function
’重命名表单
function renameform(oldname)
%>
<form method=post action=””>
<center>输入新的名字:<input type=”hidden” name=”oldname” value=’<%= oldname%>’><input type=”hidden” name=”action” value=”saverename”><input type=”text” name=”newname” value=’<%= oldname%>’ size=”100″><input type=”submit” class=”tx1″ value=”提交修改”></center>
</form>
<%
end function
’重命名
function rename(oldstr, newstr)
    oldname = split(oldstr, “,”)
    newname = split(newstr, “,”)
    for i = 0 to ubound(oldname)
        if fso.fileexists(trim(oldname(i))) then fso.movefile trim(oldname(i)), trim(newname(i))
        if fso.folderexists(trim(oldname(i))) then fso.movefolder trim(oldname(i)), trim(newname(i))
    next
    response.redirect(url&”?foldername=”&fso.getparentfoldername( oldname(0) ))
end function
’粘贴
function affix(path)
    oldname = split(session(“f”), “,”)
    if session(“action”) = “剪切” then
        for i = 0 to ubound(oldname)
            if fso.fileexists(trim(oldname(i))) then fso.movefile trim(oldname(i)), path&fso.getfilename(trim(oldname(i)))
            if fso.folderexists(trim(oldname(i))) then fso.movefolder trim(oldname(i)), trim(path)
        next
    elseif session(“action”) = “复制” then
        for i = 0 to ubound(oldname)
            if fso.fileexists(trim(oldname(i))) then fso.copyfile trim(oldname(i)), path&fso.getfilename(trim(oldname(i)))
            if fso.folderexists(trim(oldname(i))) then fso.copyfolder trim(oldname(i)), trim(path)
        next
    end if
    session(“f”) = “”
    response.redirect(url&”?foldername=”&path)
end function
’编辑
function edit(f)
    if fso.fileexists(f) then call fileform(f)
    if fso.folderexists(f) then call folderform( f )
end function
’删除
function delete( str, path )
    for each f in str
        if fso.fileexists(f) then fso.deletefile(f)
        if fso.folderexists(f) then fso.deletefolder(f)
    next
    response.redirect(url&”?foldername=”&path)
end function
’打包
function dabao( str, path )
    for each f in str
        if fso.folderexists(f) then call pack(f, path&”\”)
    next
    response.redirect(url&”?foldername=”&path)
end function
’解包
function jiebao( str, path )
    for each f in str
        if fso.fileexists(f) and instrrev(f, “.asp2004”)>0 and len(f) – instrrev(f, “.asp2004”) = 7 then install(f)
    next
    response.redirect(url&”?foldername=”&path)
end function
’上传表单
function uploadform(filepath, path)
%>
<div id=”waitting” style=”position:absolute; top:100px; left:240px; z-index:10; visibility:hidden”>
<table border=”0″ cellspacing=”1″ cellpadding=”0″ bgcolor=”0959af”>
<tr><td bgcolor=”#ffffff” align=”center”>
<table width=”160″ border=”0″ height=”50″>
<tr><td valign=”top”><div align=”center”>操&nbsp;作&nbsp;执&nbsp;行&nbsp;中<br>请稍候… </div></td></tr>
</table>
</td></tr>
</table>
</div>
<div id=”upload” style=”visibility:visible”>
<form name=”form1″ method=”post” action=”<%= url%>?action=saveupload” enctype=”multipart/form-data” >
  <table width=”100%” height=”24″ border=”1″ cellpadding=”0″ cellspacing=”0″ bordercolor=”#ffffff” bordercolorlight=”#ffffff” bordercolordark=”#000000″>
    <tr bgcolor=”#cccccc”><td bgcolor=”#cccccc”>文件上传
      <input type=”hidden” name=”act” value=”upload”></td>
    </tr>
    <tr align=”left” bgcolor=”#eeeeee”><td>
<li>需要上传的个数:<input name=”upcount” class=”tx” value=”1″><input type=”button” class=”tx1″ onclick=”setid();” value=”设定”>
<li>上传到:<input name=”filepath” class=”tx” value=”<%= filepath%>” size=”60″><input name=”path” class=”tx” size=”60″ value=”<%= path%>” style=”display=’none’”>使用绝对路径<input name=”ispath” type=”checkbox” value=”true” onclick=”if (checked){filepath.style.display=’none’;path.style.display=’’;}else{filepath.style.display=’’;path.style.display=’none’;}”>
<li>防止覆盖自动重命名<input name=”checkbox” type=”checkbox” value=”true” checked>
<li>密码:<input name=”uppass” type=”password” class=”tx”>
      </td></tr>
    <tr><td align=”left” id=”upid”></td></tr>
    <tr bgcolor=”#eeeeee”><td align=”center” bgcolor=”#eeeeee”>
          <input type=”submit” class=”tx1″ onclick=”exec();” value=”提交”>
          <input type=”reset” class=”tx1″ value=”重置”>
          <input type=”button” class=”tx1″ onclick=”window.close();” value=”取消”>
        </td></tr>
  </table>
</form></div>
<script language=”javascript”>
function exec()
{
 waitting.style.visibility=”visible”;
 upload.style.visibility=”hidden”;
}
function setid()
{
 if(window.form1.upcount.value>0)
 {
  str=’’;
  for(i=1;i<=window.form1.upcount.value;i++)
  str+=’文件’+i+’:<input type=”file” name=”file’+i+’” style=”width:400″ class=”tx1″><br>’;
  window.upid.innerhtml=str+’’;
 }
}
setid();
</script>
<%
end function
’保存上传
function saveupload()
    const filetype = “.bmp.gif.jpg.png.rar.zip.txt.”’允许上传的文件类型。以.分隔
    const maxsize = 5000000’允许的文件大小
    dim upload, file, formname, formpath
    set upload = new upload_5xsoft
    if upload.form(“filepath”)<>”” then
        if upload.form(“ispath”) = “true” then
            formpath = upload.form(“path”)
        else
            formpath = server.mappath(upload.form(“filepath”))
        end if
        if right(formpath, 1)<>”\” then formpath = formpath&”\”
        if fso.folderexists(formpath)<>true then
            fso.createfolder(formpath)
        end if
        for each formname in upload.objfile
            set file = upload.file(formname)
            temp = split(file.filename, “.”)
            fileext = temp(ubound(temp))
            if instr(1, filetype, lcase(fileext))>0 or upload.form(“uppass”) = pass then
                if upload.form(“checkbox”) = “true” then
                    randomize
                    rannum = int(90000 * rnd) + 10000
                    filename = year(now)&right(“0″&month(now),2)&right(“0″&day(now),2)&right(“0″&hour(now),2)&right(“0″&minute(now),2)&right(“0″&second(now),2)&rannum&”.”&fileext
                else
     temp = split(file.filename, “\”)
                    filename = temp(ubound(temp))
                end if
                if file.filesize>0 and (file.filesize<maxsize or upload.form(“uppass”) = pass) then
                    file.saveas formpath&filename
                end if
                set file = nothing
            end if
        next
    end if
    response.write(“<script language=’javascript’>window.opener.location.reload();self.close();</script>”)
    set upload = nothing
end function
’下载文件
function download(file)
    temp = split(file, “\”)
    filename = temp(ubound(temp))
    set s = createobject(“adodb.stream”)
    s.mode = 3
    s.type = 1
    s.open
    s.loadfromfile(file)
    data = s.read
    if isnull(data) then
        response.write “空”
    else
        response.clear
        response.contenttype = “application/octet-stream”
        response.addheader “content-disposition”, “attachment; filename=” & filename
        response.binarywrite(data)
    end if
    set s = nothing
end function
’打包
function pack(folder, path)
    randomize
    rannum = int(90000 * rnd) + 10000
    set f1 = fso.getfolder(folder)
    filename = year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rannum&”_”&f1.size
    set s = server.createobject(“adodb.stream”)
    set s1 = server.createobject(“adodb.stream”)
    set s2 = server.createobject(“adodb.stream”)
    s.open
    s1.open
    s2.open
    s.type = 1
    s1.type = 1
    s2.type = 2
    rep = fso.getparentfoldername(folder&”\”)’当前目录
    str = “folder>0>”&replace(folder, rep, “”)&vbcrlf’连目录一起打包
    call writefile(folder)
    s2.charset = “gb2312”
    s2.writetext(str)
    s2.position = 0
    s2.type = 1
    s2.position = 0
    bin = s2.read
    s1.write(bin)
    s1.seteos
    s1.savetofile(path&filename&”.asp2004″)
    s.close
    s1.close
    s2.close
    set s = nothing
    set s1 = nothing
    set s2 = nothing
end function
function writefile(folderspec)
    set f = fso.getfolder(folderspec)
    set fc = f.files
    for each f1 in fc
        if f1.name<>”pack.asp” then
            str = str&”file>”&f1.size&”>”&replace(folderspec&”\”&f1.name, rep, “”)&vbcrlf
            s.loadfromfile(folderspec&”\”&f1.name)
            img = s.read()
            if not isnull(img) then s1.write(img)
        end if
    next
    set fc = f.subfolders
    for each f1 in fc
        str = str&”folder>0>”&replace(folderspec&”\”&f1.name, rep, “”)&vbcrlf
        writefile(folderspec&”\”&f1.name)
    next
end function
’解包
function install(filename)
    tofolder = fso.getparentfoldername(filename)
    t1 = split(filename, “\”)’得到文件全名
    t2 = split(t1(ubound(t1)), “.”)’得到文件名
    t3 = split(t2(0), “_”)’得到数据大小
    size = cstr(t3(1))
    set s = server.createobject(“adodb.stream”)
    set s1 = server.createobject(“adodb.stream”)
    set s2 = server.createobject(“adodb.stream”)
    s.open
    s1.open
    s2.open
    s.type = 1
    s1.type = 1
    s2.type = 1
    s.loadfromfile(filename)
    s.position = size
    s1.write(s.read)
    s1.position = 0
    s1.type = 2
    s1.charset = “gb2312”
    s1.position = 0
    a = split(s1.readtext, vbcrlf)
    s.position = 0
    i = 0
    while(i<ubound(a))
    b = split(a(i), “>”)
    if b(0) = “folder” then
        if not fso.folderexists(tofolder&b(2)) then
            fso.createfolder(tofolder&b(2))
            ’folder=split(tofolder&b(2),”\”)’自动建立分层目录
            ’for j=0 to ubound(folder)
            ’newfolder=newfolder&folder(j)&”\”
            ’if not fso.folderexists(newfolder) then
            ’fso.createfolder(newfolder)
            ’end if
            ’next
        end if
    elseif b(0) = “file” then
        if fso.fileexists(tofolder&b(2)) then
            fso.deletefile(tofolder&b(2))
        end if
        s2.position = 0
  data = s.read(b(1))
  if not isnull(data) then s2.write(data)
        s2.seteos
        s2.savetofile(tofolder&b(2))
    end if
    i = i + 1
wend
s.close
s1.close
s2.close
set s = nothing
set s1 = nothing
set s2 = nothing
response.write(“<script language=’javascript’>window.opener.location.reload();self.close();</script>”)
end function
’检查登陆
function chklogin()
    if session(“login”) = “true” then
        exit function
    elseif request(“action”) = “chklogin” then
  server_v1=cstr(request.servervariables(“http_referer”))
  server_v2=cstr(request.servervariables(“server_name”))
  if server_v1<>”” and mid(server_v1,8,len(server_v2)) = server_v2 then
   if request(“password”) = pass then
    session(“login”) = “true”
    response.redirect(url)
   else
    response.write(“<script>alert(’登陆失败’);</script>”)
   end if
  end if
    end if
    call loginform()
end function
’登陆表单
function loginform()
%>
<body onload=”document.form1.password.focus();”>
<br><br><br><br><br>
<form name=”form1″ method=”post” action=”<%= url%>?action=chklogin”>
<center>请输入密码:<input name=”password” type=”password” class=”tx”>
<input type=”submit” class=”tx1″ value=”登陆”>
<br><br><br><br><br><br>
版权所有:<a href=”http://asp2004.net” target=”_blank”>http://<font color=red>a</font>sp2004.net</a>
</center>
</form>
</body>
<%
response.end()
end function
’注销
function logout()
    session.abandon()
    response.redirect(url)
end function
%>
<script runat=server language=vbscript>
dim data_5xsoft
class upload_5xsoft
dim objform,objfile,version
public function form(strform)
   strform=lcase(strform)
   if not objform.exists(strform) then
     form=””
   else
     form=objform(strform)
   end if
 end function
public function file(strfile)
   strfile=lcase(strfile)
   if not objfile.exists(strfile) then
     set file=new fileinfo
   else
     set file=objfile(strfile)
   end if
 end function
private sub class_initialize
  dim requestdata,sstart,vbcrlf,sinfo,iinfostart,iinfoend,tstream,istart,thefile
  dim ifilesize,sfilepath,sfiletype,sformvalue,sfilename
  dim ifindstart,ifindend
  dim iformstart,iformend,sformname
  version=”化境http上传程序 version 2.0″
  set objform=server.createobject(“scripting.dictionary”)
  set objfile=server.createobject(“scripting.dictionary”)
  if request.totalbytes<1 then exit sub
  set tstream = server.createobject(“adodb.stream”)
  set data_5xsoft = server.createobject(“adodb.stream”)
  data_5xsoft.type = 1
  data_5xsoft.mode =3
  data_5xsoft.open
  data_5xsoft.write  request.binaryread(request.totalbytes)
  data_5xsoft.position=0
  requestdata =data_5xsoft.read
  iformstart = 1
  iformend = lenb(requestdata)
  vbcrlf = chrb(13) & chrb(10)
  sstart = midb(requestdata,1, instrb(iformstart,requestdata,vbcrlf)-1)
  istart = lenb (sstart)
  iformstart=iformstart+istart+1
  while (iformstart + 10) < iformend
 iinfoend = instrb(iformstart,requestdata,vbcrlf & vbcrlf)+3
 tstream.type = 1
 tstream.mode =3
 tstream.open
 data_5xsoft.position = iformstart
 data_5xsoft.copyto tstream,iinfoend-iformstart
 tstream.position = 0
 tstream.type = 2
 tstream.charset =”gb2312″
 sinfo = tstream.readtext
 tstream.close
 iformstart = instrb(iinfoend,requestdata,sstart)
 ifindstart = instr(22,sinfo,”name=”””,1)+6
 ifindend = instr(ifindstart,sinfo,””””,1)
 sformname = lcase(mid (sinfo,ifindstart,ifindend-ifindstart))
 if instr (45,sinfo,”filename=”””,1) > 0 then
  set thefile=new fileinfo
  ifindstart = instr(ifindend,sinfo,”filename=”””,1)+10
  ifindend = instr(ifindstart,sinfo,””””,1)
  sfilename = mid (sinfo,ifindstart,ifindend-ifindstart)
  thefile.filename=getfilename(sfilename)
  thefile.filepath=getfilepath(sfilename)
  ifindstart = instr(ifindend,sinfo,”content-type: “,1)+14
  ifindend = instr(ifindstart,sinfo,vbcr)
  thefile.filetype =mid (sinfo,ifindstart,ifindend-ifindstart)
  thefile.filestart =iinfoend
  thefile.filesize = iformstart -iinfoend -3
  thefile.formname=sformname
  if not objfile.exists(sformname) then
    objfile.add sformname,thefile
  end if
 else
  tstream.type =1
  tstream.mode =3
  tstream.open
  data_5xsoft.position = iinfoend
  data_5xsoft.copyto tstream,iformstart-iinfoend-3
  tstream.position = 0
  tstream.type = 2
  tstream.charset =”gb2312″
         sformvalue = tstream.readtext
         tstream.close
  if objform.exists(sformname) then
    objform(sformname)=objform(sformname)&”, “&sformvalue
  else
    objform.add sformname,sformvalue
  end if
 end if
 iformstart=iformstart+istart+1
 wend
  requestdata=””
  set tstream =nothing
end sub
private sub class_terminate
 if request.totalbytes>0 then
 objform.removeall
 objfile.removeall
 set objform=nothing
 set objfile=nothing
 data_5xsoft.close
 set data_5xsoft =nothing
 end if
end sub
 private function getfilepath(fullpath)
  if fullpath <> “” then
   getfilepath = left(fullpath,instrrev(fullpath, “\\”))
  else
   getfilepath = “”
  end if
 end  function
 private function getfilename(fullpath)
  if fullpath <> “” then
   getfilename = mid(fullpath,instrrev(fullpath, “\\”)+1)
  else
   getfilename = “”
  end if
 end  function
end class
class fileinfo
  dim formname,filename,filepath,filesize,filetype,filestart
  private sub class_initialize
    filename = “”
    filepath = “”
    filesize = 0
    filestart= 0
    formname = “”
    filetype = “”
  end sub
 public function saveas(fullpath)
    dim dr,errorchar,i
    saveas=true
    if trim(fullpath)=”” or filestart=0 or filename=”” or right(fullpath,1)=”/” then exit function
    set dr=createobject(“adodb.stream”)
    dr.mode=3
    dr.type=1
    dr.open
    data_5xsoft.position=filestart
    data_5xsoft.copyto dr,filesize
    dr.savetofile fullpath,2
    dr.close
    set dr=nothing
    saveas=false
  end function
  end class
</script>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » WEB文件管理器2.0版-ASP教程,ASP应用
分享到: 更多 (0)