用asp实现文件浏览、上传、下载的程序(5)
Else
GetFileName = ""
End If
End function
Public Function GetFileExt(FullPath)
If FullPath <> "" Then
GetFileExt = LCase(Mid(FullPath,InStrRev(FullPath, ".")+1))
Else
GetFileExt = ""
End If
End function
Public Function GetNewFileName()
dim ranNum
dim dtNow
dtNow=Now()
ranNum=int(90000*rnd)+10000
GetNewFileName=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum
End Function
Public Function isAllowExt(Ext)
if NoAllowExt="" then
isAllowExt=cbool(InStr(1,";"&AllowExt&";",LCase(";"&Ext&";")))
else
isAllowExt=not CBool(InStr(1,";"&NoAllowExt&";",LCase(";"&Ext&";")))
end if
End Function
End Class
Class clsFileInfo
Dim FormName,FileName,FilePath,FileSize,FileMIME,FileStart,FileExt
End Class
%>
<%
function deletefile(filename)
set objfilesys=server.createobject("scripting.filesystemobject")
ss=filename
ss=foldinfo&ss
if objfilesys.FILEExists(ss) then
objfilesys.deleteFILE ss
end if
end function
function deletedir(dirname)
set objfilesys=server.createobject("scripting.filesystemobject")
ss=dirname&idd
ss=server.mappath(ss)
if objfilesys.FOLDERExists(ss) then
objfilesys.deleteFOLDER ss
end if
end function
function download(filename)
Response.Buffer = true
Response.Clear
dim url
Dim fso,fl,flsize
dim Dname
Dim objStream,ContentType,flName,isre,url1
Dname=filename
If Dname<>"" Then
url=foldinfo&Dname
End If
Set fso=Server.CreateObject("Scripting.FileSystemObject")
内容版权声明:除非注明,否则皆为本站原创文章。