📄 mobileup2.asp
字号:
<%
if session("admin")="" and session("flag")="" then
response.redirect "admin.asp"
end if
%>
<!--#include FILE="upload.inc"-->
<!--#include FILE="conn.asp"-->
<!--#include FILE="char.asp"-->
<%
sq1="select * from upset where id=1"
Set Rs1 = Server.CreateObject("Adodb.Recordset")
rs1.open sq1,conn,1,2
rsformPath=rs1("formPath")
rsnamekind=rs1("namekind")
rsfilesize=rs1("filesize")
rsallowedfile=rs1("allowedfile")
rsforceup=rs1("forceup") '
rs1.close
Set rs1=Nothing
If Right(rsformPath,1)<>"\" Then rsformPath=rsformPath&"\"
%>
<%
dim upload,file,formName,formPath,iCount
Dim sjs,fname,i,l,newfilelist,uploaddir,filename,ii
''--------------------------
Server.ScriptTimeOut=999999
set upload=new upload_5xsoft
''---------------------------获得变量值
fullpath=Server.Mappath("\")&"\"
addip=request.serverVariables("remote_host")
title=upload.form("title")
If title="" Then response.Redirect"err.asp?id=1"
''--------------------------保存路径
formPath=rsformPath
fullpath=fullpath&rsformPath
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder(fullpath)
If err<>0 Then response.Redirect"err.asp?id=6"
''--------------------------
iCount=0
for each formName in upload.objFile ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
size=file.filesize
''-------------------------限制文件大小
If size>rsfilesize*1024 Then response.Redirect"err.asp?id=3"
If size=0 Then response.Redirect"err.asp?id=5"
''-------------------------获得文件类型
filetype=file.filename
i=InStrRev(filetype,".")
l=Len(filetype)
If i>0 Then
filetype=Right(filetype,l-i+1)
End If
''-------------------------限制文件类型
filetype=LCase(filetype)
filetype=Replace(filetype,".","")
filetype=CStr(filetype)
If InStr(rsallowedfile,filetype)=0 Then response.Redirect"err.asp?id=2"
''----------------取得新文件名
If rsnamekind=1 Then
fname=file.filename
Else
RANDOMIZE
sjs=INT((99-00+1)*RND+00)
fname=year(date)&month(date)&day(date)&hour(time())&minute(time())&second(time())&sjs
fname=fname&"."&filetype
End if
''-------------------------检验文件是否存在
If rsforceup="F" then
sq1="select * from article where filesize='"&size&"'"
Set Rs1 = Server.CreateObject("Adodb.Recordset")
rs1.open sq1,conn,1,2
If Not rs1.bof Or Not rs1.eof Then response.Redirect"err.asp?id=4&size="&size&""
Else
sq1="select * from article where filesize='"&size&"'"
Set Rs1 = Server.CreateObject("Adodb.Recordset")
rs1.open sq1,conn,1,2
End If
''--------------------------
if file.filesize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs fullpath&fname ''保存文件
iCount=iCount+1
msg="文件上传成功!"
End If
datadir=formPath&fname
dateandtime=date()
rs1.addnew
rs1("dataname")=fname
rs1("title")=title
rs1("content")=upload.form("content")
rs1("datadir")=datadir
rs1("dateandtime")=dateandtime
rs1("filesize")=size
rs1("classid")=upload.form("classid")
rs1("nclassid")=upload.form("Nclassid")
rs1("writer")=upload.form("writer")
rs1("articleon")=upload.form("articleon")
rs1.update
rs1.close
set file=nothing
next
set upload=nothing '删除此对象
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table align="center" width="50%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#000000">
<tr>
<td bgcolor=#999999 colspan="2" align="center"><B>文件上传成功</B></td>
</tr>
<%
size=CStr(size)
sq2="select * from article where filesize='"&size&"' order by articleid desc"
Set Rs2 = Server.CreateObject("Adodb.Recordset")
rs2.open sq2,conn,1,2
id=rs2("articleid")
title=rs2("title")
classid=rs2("classid")
nclassid=rs2("nclassid")
content=rs2("content")
size=rs2("filesize")
writer=rs2("writer")
dateandtime=rs2("dateandtime")
rs2.close
Set rs2=nothing
%>
<tr bgcolor=#FFFFFF><td bgcolor=#999999 width="20%">ID:</td><td width="80%"><%=id%></td></tr>
<tr bgcolor=#FFFFFF><td bgcolor=#999999 width="20%">名称:</td><td width="80%"><%=title%></td></tr>
<tr bgcolor=#FFFFFF><td bgcolor=#999999 width="20%">描述:</td><td width="80%"><%=content%></td></tr>
<tr bgcolor=#FFFFFF><td bgcolor=#999999 width="20%">大小:</td><td width="80%"><%size=Round(size/1024,2)
If Left(size,1)="." Then size="0"&size
%>
<%=size%>KB</td></tr>
<tr bgcolor=#FFFFFF><td bgcolor=#999999 width="20%">上传人:</td><td width="80%"><%=writer%></td></tr>
<tr bgcolor=#FFFFFF><td bgcolor=#999999 width="20%">上传时间:</td><td width="80%"><%=dateandtime%></td></tr>
<tr bgcolor=#999999><td colspan="2" width="100%" align="center"><B><a href='softdown.asp?id=<%=id%>&aid=<%=classid%>&bid=<%=nclassid%>'>到下载页面</a></B></td></tr>
<tr bgcolor=#999999><td colspan="2" width="100%" align="center"><B><a href='upadd.asp'>继续上传</a></B></td></tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -