📄 job_upok.asp
字号:
<%OPTION EXPLICIT%>
<!--#include FILE="job_upclass.asp"-->
<%
dim upfile,formPath,ServerPath,FSPath,formName,FileName,oFile,upfilecount
upfilecount=0
set upfile=new upfile_class
'upfile.AllowExt="jpg;gif;bmp;png;swf;doc;xls;rar;zip"
upfile.AllowExt="jpg;gif;bmp;png;swf;"
upfile.GetData (1024000)'限制最大上传100k
%>
<html>
<head>
<title>文件上传</title>
<style type="text/css">
<!--
body{ font-size: 12px; font-family: 宋体 }
table{ font-size: 12px; font-family: 宋体 }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="menu" leftmargin="20" topmargin="20">
<%
if upfile.isErr then '如果出错
select case upfile.isErr
case 1
Response.Write "你没有上传数据呀?是不是搞错了?"
case 2
Response.Write "你上传的文件超出我们的限制,最大100K"
end select
else
%>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" style="border-collapse: collapse">
<tr bgcolor="#CCCCCC">
<td height="25" align="center"> 本地文件 </td>
<td align="center"> 大小(字节) </td>
<td align="center"> 状态 </td>
</tr>
<%
FSPath=GetFilePath(Server.mappath("job_upok.asp"),"\")'取得当前文件在服务器路径
ServerPath=GetFilePath(Request.ServerVariables("HTTP_REFERER"),"/")'取得在网站上的位置
for each formName in upfile.file '列出所有上传了的文件
set oFile=upfile.file(formname)
FileName=upfile.form(formName)'取得文本域的值
if not FileName>"" then FileName=oFile.filename'如果没有输入新的文件名,就用原来的文件名
upfile.AutoSave formname,FSPath&FileName ''保存文件 也可以使用AutoSave来保存,参数一样,但是会自动建立新的文件名
%>
<tr>
<td height="20" valign='middle'> <%=oFile.FilePath%><%=FileName%> </td>
<td valign='middle'> <%=oFile.filesize%></td>
<td valign='middle'>
<%
if upfile.iserr then
Response.Write upfile.errmessage
else
upfilecount=upfilecount+1
Response.Write "上传成功"
end if
%>
</td>
</tr>
<%
set oFile=nothing
next
end if
set upfile=nothing '删除此对象
%>
</table>
</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 + -