📄 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 + -