If action = "saveupload" Then
On Error Resume Next
server.ScriptTimeout = 999
Const filetype = ".gif.jpg.png.rar.zip.txt."'允许上传的文件类型。以.分隔
Const MaxSize = 2097152'允许的文件大小
Dim upload, File, formName, formPath
Set upload = New upload_5xsoft
If upload.Form("filepath")<>"" Then
formPath = upload.Form("filepath")
If Right(formPath, 1)<>"/" Then formPath = formPath&"/"
Set mypath = Server.CreateObject("Scripting.FileSystemObject")
If mypath.FolderExists(server.MapPath("./")&"\"&formPath)<>true Then
mypath.CreateFolder(server.MapPath("./")&"\"&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)&Month(Now)&Day(Now)&Hour(Now)&Minute(Now)&Second(Now)&ranNum&"."&fileExt
Else
filename = File.FileName
End If
If File.FileSize>0 And (File.FileSize<MaxSize Or upload.Form("uppass") = pass) Then
File.SaveAs Server.mappath(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 If