<%
' 忽略所有错误
on error resume next
Server.ScriptTimeOut = 1800
dim constPath,mypath
mypath=server.mappath("Wml_Upfile.asp")
constPath=replace(mypath,"Wml_Upfile.asp","")
dim upload,oFile,formName,SavePath,filename,fileExt,oFileSize,sizes
dim EnableUpload
dim arrUpFileType
dim ranNum
dim msg,FoundErr,MaxFileSize
MaxFileSize="102400"'最大上传文件,以KB为单位
msg=""
FoundErr=false
EnableUpload=true
dim strMonth,strDay
dim tid,action,bbsid,title,content,content1,content2,content3,content4,content5
kk=0
set upload=new upfile_class ''建立上传对象
upload.GetData(104857600) '取得上传数据,限制最大上传100M
if upload.err > 0 then '如果出错
select case upload.err
case 1
msg= "请先选择你要上传的文件!"
case 2
msg= "你上传的文件总大小超出了最大限制(100M)"
end select
'showWML()
response.end
end if
SavePath = "/wml/"
content=forbbs(upload.form("content"))
if len(content1)>30 or len(content2)>30 or len(content3)>30 or len(content4)>30 or len(content5)>30 then
Call Error("命名最多30字,请返回重试!")
end if
for each formName in upload.file
set ofile=upload.file(formName) '生成一个文件对象
upfilename=ofile.FileName
oFileSize=ofile.filesize
sizes=cstr(round(oFileSize/1024))
fileExt=lcase(ofile.FileExt)
if fileEXT<>"wml" then
EnableUpload=false
end if
if EnableUpload=false then
msg="这种文件类型不允许上传:asp|asa|aspx|exe|bat|..."
FoundErr=true
call error("只支持WML格式文件!")
response.end
end if
if oFileSize>(MaxFileSize*1024) then
msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!"
FoundErr=true
'showWML()
msg=msg & "
返回上级
"
response.write msg
response.write "