?? upfile.asp
字號:
<%OPTION EXPLICIT%>
<!--#include FILE="../upclass.asp"-->
<%
dim upfile,formPath,ServerPath,FSPath,formName,FileName,oFile,upfilecount,iCount
upfilecount=0
set upfile=new upfile_class ''建立上傳對象
upfile.AllowExt="rar;ppt;doc;xls;txt;zip;" '設置上傳類型的白名單
'upfile.NoAllowExt="asp;exe;htm;html;aspx;cs;vb;js;" '設置上傳類型的黑名單
upfile.GetData (-1) '取得上傳數據,限制最大上傳10M
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/css.css">
</head>
<body bgcolor="#eeeeee" topmargin="0" leftmargin="0">
<%dim title,sendto,i,bs,content,gs,id,x
formpath=GetFilePath(Server.mappath("upfile.asp"),"\")&"file\"
iCount=1
for each formName in upfile.file ''列出所有上傳了的文件
set ofile=upfile.file(formName) ''生成一個文件對象
if ofile.FileSize>0 then ''如果 FileSize > 0 說明有文件數據
id=upfile.GetNewFileName()
x=mid(ofile.filename,instr(ofile.filename,"."))
filename=id&x
upfile.SaveToFile formname,formPath&id&x ''保存文件
if upfile.iserr then
Response.Write upfile.errmessage
else
response.Write "上傳軟件成功"
response.write "<script>parent.document.forms[0].url.value='file/" &filename& "'</script>"
response.write "<script>parent.document.forms[0].size.value='"&round(ofile.FileSize/1024)&"K'</script>"
end if
else
response.write "不能上傳空軟件[ <a href=# onclick=history.go(-1)>重新上傳</a> ]"
end if
iCount=iCount+1
set file=nothing
next
set upfile=nothing ''刪除此對象
%>
</body>
</html>
<%
function GetFilePath(FullPath,str)
If FullPath <> "" Then
GetFilePath = left(FullPath,InStrRev(FullPath, str))
Else
GetFilePath = ""
End If
End function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -