📄 upload.asp
字号:
<!--#include FILE="uploadc.asp"-->
<!--#include file="Connections/tar.asp" -->
<html>
<head>
<title>文件上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath,iCount,filename,fileExt
set upload=new upload_5xSoft ''建立上传对象
formPath=upload.form("filepath")
''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
iCount=0
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
filename=formPath & year(now) & "a" & month(now) & "a" & day(now) & "a" & hour(now) & "a" & minute(now) & "a" & second(now) & file.FileName
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(filename) ''保存文件
'response.write file.FilePath&file.FileName&" ("&file.FileSize&") => "&formPath&File.FileName&" 成功!<br>"
iCount=iCount+1
end if
'set file=nothing
next
%>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_tar_STRING
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
rs.source="SELECT * FROM tar where ID=" & upload.form("TarID")
rs.open
rs("update_time")=date()
if isnumeric(mid(rs("status"),1,len(rs("status"))-2)) and session("issupport")<>"1" then
rs("status")=(mid(rs("status"),1,len(rs("status"))-2)-1+2) & "回复"
else
rs("status")="1回复"
end if
rs.update
rs.close
rs.Source = "SELECT * FROM tar_history"
rs.open
rs.addnew
rs("TarID")=upload.form("TarID")
rs("pbtime")=now()
rs("content")="上传文件" & file.FilePath&file.FileName
rs("username")=session("username")
rs("upload_Content")="<a href=""" & filename & """ target=_blank>下载文件</a>"
rs.update
rs.close
set upload=nothing ''删除此对象
response.write iCount&" 个文件上传结束!"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -