?? upfile.asp
字號:
<%OPTION EXPLICIT%>
<%Server.ScriptTimeOut=5000%>
<!--#include file="Config.asp"-->
<!--#include FILE="upload.inc"-->
<head>
</head>
<body topmargin="0" leftmargin="0">
<%
if gx=1 then
if session("person")="" then
response.write"<script>alert('對不起,您未登錄!');history.back();</script>"
end if
dim upload,file,formName,formPath,iCount,fname,ffname,zj
set upload=new upload_5xsoft ''建立上傳對象
if upload.form("filepath")="" then ''得到上傳目錄
HtmEnd "請輸入要上傳至的目錄!"
set upload=nothing
response.end
else
formPath=upload.form("filepath")
''在目錄后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
end if
iCount=0
for each formName in upload.objForm ''列出所有form數據
next
for each formName in upload.objFile ''列出所有上傳了的文件
set file=upload.file(formName) ''生成一個文件對象
if file.FileSize>512000 then
response.write"<script>alert('對不起,文件超過500K!');history.back();</script>"
response.end
end if
if right(file.FileName,3)<>"rar" and right(file.FileName,3)<>"zip" and right(file.FileName,3)<>"txt" and right(file.FileName,3)<>"doc" and right(file.FileName,3)<>"xls" then
response.write"<script>alert('對不起,您上傳的文件類型不允許!');history.back();</script>"
response.end
end if
if file.FileSize>0 then ''如果 FileSize > 0 說明有文件數據
file.SaveAs Server.mappath(formPath&file.FileName) ''保存文件
fname=formPath&File.FileName
ffname=File.FileName
zj=file.FileSize
iCount=iCount+1
end if
set file=nothing
next
set upload=nothing ''刪除此對象
Htmend iCount&""
sub HtmEnd(Msg)
set upload=nothing
response.write " 文件上傳成功!<script>parent.document.ftiwen.fname.value='"&fname&"';</script><script>parent.document.ftiwen.zj.value='"&zj&"';</script><script>parent.document.ftiwen.ffname.value='"&ffname&"';</script>"
response.end
end sub
else
Response.Write ("<script>alert('對不起,共享資料功能未啟用!');history.back();</script>")
Response.end
end if
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -