📄 manage_file_save.asp
字号:
<%
'功能:保存文件信息
'参数:request("typeid")=int #当前文件夹ID; request("page")=int #当前页码; request.form("addedit_subed")="true"#表单提交;
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<!--#include FILE="../inc/upload.asp"-->
<%
'response.buffer=false
formPath="./files/"
set upload=new upload_5xSoft
'------------------------------------------------设置参数
LoginID=trim(session("LoginID")) : if LoginID="" then LoginID=0 '当前用户ID
typeid=upload.form("typeid") : if typeid="" then typeid=1 '当前文件夹ID
currentpage=upload.form("page") : if currentpage="" then currentpage=1 '当前页码
name=upload.form("name")
body=upload.form("body")
sdate=date()
'------------------------------------------------
table="tbioaDownloadFile"
'添加时使用的字段
set file=upload.file("url")
set fs=CreateObject("Scripting.FileSystemObject")
if fs.FileExists(Server.mappath(formPath&file.FileName))=true then
response.write"<html><head></head><body><script>alert('文件同名!\n\n“"&file.FileName&"” 已经上传,请另取文件名\n');history.back();</script></body></html>"
response.end
end if
url=file.FileName
if file.FileSize>0 then
file.SaveAs Server.mappath(formPath&file.FileName) ''保存文件
filemod="(文件名:"&file.FileName&" 文件大小:"&file.FileSize&")"
else
response.write"<html><head></head><body><script>alert('文件路径无效!\n\n“"&file.FilePath&file.FileName&"” 不是本地机的有效文件\n');history.back();</script></body></html>"
response.end
end if
set file=nothing
field1=array("name","typeid","body","url","sdate")
value1=array(name,typeid,body,url,sdate)
for i=0 to ubound(field1)
value1(i)=replace(value1(i),"'","''")
next
sql = "INSERT INTO " & table & " (" & Join(field1, ",") & ") VALUES ('" & Join(value1, "','") & "')"
word="<p>文件信息已成功加入!</p><p><img border=0 src=../images/icon_show.gif align=left width=16 height=16><a href=manage_file_index.asp?typeid="&typeid&">返回文件夹</a>"
set upload=nothing
oConn.Execute sql
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css" type=text/css>
<title>main</title>
<base target="FrmMain">
</head>
<body topmargin="10" leftmargin="10">
<!--#include file="manage_menu.html"-->
<hr width="100%" size=1 color="#000000">
<!--#include file="file_head.html"-->
<hr width="100%" size=1 color="#000000">
<br>
<div align="center">
<table width="350" cellspacing="1" cellpadding="2" class="tab">
<tr>
<td width="100%" class="tdTop">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="tdTop">
<p align="left"><img border="0" src="../images/icon_title.gif" align="left">添加文件</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="25%" class="td1">
<table border="0" width="100%" cellspacing="10" cellpadding="0">
<tr>
<td width="36%">
<p align="right"><img border="0" src="../images/edit.gif" width="32" height="32">
</td>
<td width="64%"><p> </p>
<%=word%>
</td>
</tr>
<tr>
<td width="100%" colspan="2">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="25%" class="tdBottom">
</td>
</tr>
</table>
</div>
</body>
</html>
<%'释放对象变量
oConn.close
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -