📄 default.asp
字号:
<!--#include file='connect.asp'-->
<%
'session.abandon
'Server.ScriptTimeOut=500
function opendb(DBPath,sessionname,dbsort)
dim conn
'if not isobject(session(sessionname)) then
Set conn=Server.CreateObject("ADODB.Connection")
'if dbsort="accessdsn" then conn.Open "DSN=" & DBPath
'if dbsort="access" then conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
'if dbsort="sqlserver" then conn.Open "DSN=" & DBPath & ";uid=wsw;pwd=wsw"
DBPath1=server.mappath("../db/jzud-oa.asa")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set session(sessionname)=conn
'end if
set opendb=session(sessionname)
end function
%>
<%
'-----------------------------------------
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='../default.asp';")
response.write("</script>")
response.end
end if
%>
<html>
<head>
<title>上传文件页面</title>
<style>
body {font-size:9pt}
td {font-size:9pt}
input {font-size:9pt}
textarea {font-size:9pt}
</style>
<script language='Jscript'>
function checkSub(src){
if(src.filename.value==''){
alert("文件主题必须输入!");
src.filename.focus();
return (false)
}
}
</script>
</head>
<body style='margin:0;background:#FFFFFF'>
<table border='1' width='90%' align='center' cellspacing="0" cellpadding="5" bordercolorlight="#808080" bordercolordark="#D4D0C8">
<tr height='100' bgcolor='#003399'>
<td align='center' bgcolor="#FFFFFF" style='color:#ffffff;font-family:黑体;Arial'>
<h1> <font color="#FF0000">文 件 共 享</font></h1></td>
</tr>
<tr>
<td valign='top' bgcolor='#FFFFFF'><br> 文件列表(所有文件只保存30天):<br>
<table border='0' width='90%' align='center' cellspacing="2" cellpadding="0">
<%
Dim Sql
Dim Rs
Sql="select top 100 * from upfile_table order by id desc"
set Rs=Server.CreateObject("Adodb.Recordset")
Rs.Open Sql,conn,1,1
if not Rs.EOF then
while not Rs.EOF
Response.Write "<tr height='20'><td width='10%' nowrap>主题:</td><td>"& Rs("id") &"、"& Rs("Subject") &" ["& Rs("filesize") &" Bytes]</td></tr>"
Response.Write "<tr height='20'><td width='10%' nowrap>文件:</td><td><a href='"& Rs("filePath") &"/"& Rs("Filename") &"' target=_blank>"& Rs("Filename") &"</a></td></tr>"
Response.Write "<tr height='20'><td width='10%' nowrap>简介:</td><td>"& Rs("Expit") &"<hr></td></tr>"
Rs.MoveNext
wend
else
Response.Write "<tr><td>无记录</td></tr>"
end if
Rs.Close
set Rs=nothing
Conn.close
set conn=nothing
%>
</table> </td>
</tr>
<tr>
<td bgcolor='#D4D0C8'>
该页面设定可上传文件大小为<font color='red'> 5M </font>以下,并如果已经存在同名文件将报错(具体可按需设定)
<div align="center">
<center>
<table border='0' width="500" cellpadding="4">
<form method="POST" action="upfile.asp" enctype="multipart/form-data" id="form1" name="form1" onsubmit='return checkSub(this)'>
<tr>
<td width="331" align="right">报错:</td>
<td width="490"><input type='radio' name='errnumber' value='0'>
自动更名
<input type='radio' name='errnumber' value='1' checked>
报错方式
<input type='radio' name='errnumber' value='2'>
直接覆盖</td>
</tr>
<tr>
<td width="331" align="right">主题:</td>
<td width="490"><input type='text' name='filename' size='30'></td>
</tr>
<tr>
<td width="331" align="right">文件:</td>
<td width="490"><input type="file" name="fruit" size="30"></td>
</tr>
<tr>
<td valign='top' width="331" align="right">简介:</td>
<td width="490"><textarea name='fileExt' cols='40' rows='5'></textarea></td>
</tr>
<tr>
<td colspan='2' width="815">
<p align="center"><input type="submit" value="上传文件" name="subbutt"></p>
</td>
</tr>
</form>
</table></center>
</div>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -