?? upload_c1.asp
字號:
<!--#include file="upload_snsn.inc"-->
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
filepath=trim(upload.form("filepath"))
filelx=trim(upload.form("filelx"))
i=0
for each formName in upload.File
set file=upload.File(formName)
fileExt=lcase(file.FileExt) '得到的文件擴展名不含有.
if file.filesize<10 then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">請先選擇你要上傳的文件! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
if filelx="1" then
if fileext<>"gif" and fileext<>"jpg" then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">只能上傳jpg或gif格式的圖片! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
if file.filesize>(300*1024) then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">最大只能上傳 300K 的圖片文件! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
end if
if filelx="2" then
if fileext<>"gif" and fileext<>"jpg" and fileext<>"swf" then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">只能上傳jpg、gif格式的圖片或swf格式的Flash文件! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
if file.filesize>(300*1024) and fileext<>"swf" then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">最大只能上傳 300K 的圖片文件! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
if file.filesize>(3000*1024) and fileext="swf" then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">最大只能上傳 3M 的Flash文件! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
end if
if filelx="3" then
if fileext<>"htm" then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">只能上傳htm格式的網頁文件! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
if file.filesize>(300*1024) then
response.write "<span style=""font-family: 宋體; font-size: 9pt"">最大只能上傳 300K 的網頁文件! [ <a href=# onclick=history.go(-1)>重新上傳</a> ]</span>"
response.end
end if
end if
randomize
ranNum=int(90000*rnd)+10000
filename1=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
admin="adminn"
filename=filepath&filename1
if file.FileSize>0 then ''如果 FileSize > 0 說明有文件數據
'file.SaveAs Server.mappath(filename) ''保存文件
file.SaveToFile Server.mappath(FileName)
if trim(upload.form("FormName"))="" then
%>
<html>
<head>
<title>上傳文件成功</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body >
<center>
<div style="width:400px;margin-top:10px;padding:3px 0;text-align:center;font-size:12px;color:#cccccc;border:solid 1px;border-color:#cccccc #cccccc #cccccc;background:#cccccc">上傳結果報告</div>
<div style="width:400px;padding:20px;font-size:12px;color:#cccccc;border:solid 1px;border-color:#cccccc #cccccc #cccccc;">
<%
response.write file.FileName&" 上傳成功! <br>"
response.write "新文件名:"&FileName1&"<br>"
response.write "請將你網頁上的原圖片文件名改為上傳后的新文件名!<br>"
%>
<input type='button' style='width:65px;height:20px;font-size:12px' value='關閉' onclick='window.close()'></div>
<div style='width:400px;padding:3px 0;font-size:12px;color:#cccccc;border:solid 1px;border-color:#cccccc #cccccc #cccccc;background:#cccccc;'></div>
</center>
</body>
</html>
<%
else
response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&admin&"/"&FileName&"'</script>"
%>
<script language="javascript">
window.alert("文件上傳成功!請不要修改生成的鏈接地址!");
window.close();
</script>
<%
end if
end if
set file=nothing
next
set upload=nothing
end if
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -