if upload.form("GuFolderPath")<>"" then GuFolderPath=upload.form("GuFolderPath") call FolderNameCheck(GuFolderPath) GuFolderPath=upload.form("GuFolderPath") if right(GuFolderPath,1)<>"/" then GuFolderPath=GuFolderPath&"/"
elseif upload.form("GuFolderPath")="" and GuFolder0<>"" then GuFolderPath=GuFolder0 call FolderNameCheck(GuFolderPath) GuFolderPath=GuFolder0 if right(GuFolderPath,1)<>"/" then GuFolderPath=GuFolderPath&"/"
else GuFolderPath=""
end if
iCount=0 for each formName in upload.objForm '列出所有form数据 'Response.write formName&"="&upload.form(formName)&" " next
Response.write "
"
for each formName in upload.objFile '列出所有上传了的文件
set file=upload.file(formName)
if file.FileSize>0 then
dim FileExtF,FileExtY,FileExtOK,ii,jj FileExtF=split(File.FileName,".") for jj=0 to ubound(FileExtF) next FileExtY=0 FileExtOK=split(GuFileExt0,"|")
for ii=0 to ubound(FileExtOK) if FileExtOK(ii)=FileExtF(jj-1) then FileExtY=1 exit for end if next
if FileExtY=0 then response.Write "上传失败,不允许上传的文件类型"
elseif file.FileSize>GuFileSize0*1024 then response.Write "上传失败,单个文件大小超过限制,最大"&GuFileSize0&"*1024 字节,1K=1024字节"
else dim FileNameOK if GuAutoName="1" then FileNameOK=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&iCount&"."&FileExtF(jj-1) else FileNameOK=file.FileName end if
dim pictext '标题: upload.form("pictext") 'call savedata(file.FileName,file.FileSize) Response.write "" 'iCount=iCount+1
end if
else response.Write "上传失败,请选择要上传的文件"
end if
set file=nothing
next
set upload=nothing
'response.Write "上传成功!"
Sub FolderNameCheck(FolderNameNew)
dim Letters,i,c Letters="+=:;,[]<>\|*?" for i=1 to len(FolderNameNew) c=mid(FolderNameNew,i,1) if inStr(Letters,c)<>0 then Htmend "上传失败,文件夹名称含有特殊字符" end if next
GuFolderPath=server.MapPath(GuFolderPath) Set fso=Server.CreateObject("Scripting.FileSystemObject") if fso.FolderExists(GuFolderPath)=false then fso.CreateFolder(GuFolderPath) end if Set fso=nothing