?? upme2.asp
字號(hào):
<!--
┌─ o91.com───────────────┐
│ 動(dòng)感購(gòu)物商務(wù)平臺(tái)WWW.SNSN.NET版權(quán)所有 │
│ 設(shè)計(jì):模糊視線13855119911 QQ:9912515 │
└────────────────────┘
-->
<!--#include file="upload_wj.inc"-->
<!--#include file="conn.asp" -->
<%
const upload_type=0 '上傳方法:0=無(wú)組件上傳類
Const MaxFileSize=2000 '上傳文件大小限制
Const UpFileType="png|gif|jpg|bmp" '允許的上傳文件類型
dim upload,file,formName,SavePath,filename,fileExt
dim upNum
dim EnableUpload
dim Forumupload
dim ranNum
dim uploadfiletype
dim msg,founderr
msg=""
founderr=false
EnableUpload=false
SavePath = "uploadpic" '存放上傳文件的目錄
if right(SavePath,1)<>"/" then SavePath=SavePath&"/" '在目錄后加(/)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
select case upload_type
case 0
call upload_0() '使用化境無(wú)組件上傳類
case else
end select
%>
</body>
</html>
<%
sub upload_0() '使用化境無(wú)組件上傳類
set upload=new upload_file '建立上傳對(duì)象
for each formName in upload.file '列出所有上傳了的文件
set file=upload.file(formName) '生成一個(gè)文件對(duì)象
if file.filesize<100 then
msg="請(qǐng)先選擇你要上傳的文件!"
founderr=true
end if
if file.filesize>(MaxFileSize*1024) then
msg="文件大小超過(guò)了限制,最大只能上傳" & CStr(MaxFileSize) & "K的文件!"
founderr=true
end if
fileExt=lcase(file.FileExt)
Forumupload=split(UpFileType,"|")
for i=0 to ubound(Forumupload)
if fileEXT=trim(Forumupload(i)) then
EnableUpload=true
exit for
end if
next
if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
EnableUpload=false
end if
if EnableUpload=false then
msg="這種文件類型不允許上傳!\n\n只允許上傳這幾種文件類型:" & UpFileType
founderr=true
end if
strJS="<SCRIPT language=javascript>" & vbcrlf
if founderr<>true then
randomize
ranNum=int(900*rnd)+100
filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
file.SaveToFile Server.mappath(FileName) '保存文件
filename1=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
msg="上傳文件成功!"
strJS=strJS & "content=parent.document.pic.a.value;"
FileType=right(fileExt,3)
select case FileType
case "jpg","gif","png","bmp"
strJS=strJS &"content=content+'" & filename & "';" & vbcrlf
case "mht"
strJS=strJS & "content=content+'" & filename & "';" & vbcrlf
case "swf"
strJS=strJS & "content=content+'" & filename & "';" & vbcrlf
end select
strJS=strJS & "parent.document.pic.a.value=content;" & vbcrlf
strJS=strJS & "content=parent.document.pic.f.value;"
FileType=right(fileExt,3)
select case FileType
case "jpg","gif","png","bmp"
strJS=strJS &"content=content+'" & filename1 & "';" & vbcrlf
case "mht"
strJS=strJS & "content=content+'" & filename1 & "';" & vbcrlf
case "swf"
strJS=strJS & "content=content+'" & filename1 & "';" & vbcrlf
end select
strJS=strJS & "parent.document.pic.f.value=content;" & vbcrlf
end if
strJS=strJS & "alert('" & msg & "');" & vbcrlf
strJS=strJS & "window.location = 'upme2.htm';" & vbcrlf
strJS=strJS & "</script>"
response.write strJS
set file=nothing
next
set upload=nothing
end sub
%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -