📄 matrix3_pic_upload.asp
字号:
<!--#include file="const.asp"-->
<!-- #include file="matrix3_upload_inc.asp" -->
<!-- #include file="matrix3_upload_config.asp" -->
<%
call opendb()
checkadmin()
dim rnum,upload,file,fname,tmpsiteurl,rs,filename,filesize,filepath,filetype
tmpsiteurl=getpath123("http://"&request.ServerVariables("SERVER_NAME")&":"&request.ServerVariables("SERVER_PORT")&request.ServerVariables("URL"))
tmpsiteurl=replace(tmpsiteurl,":80","")
set upload=new matrix3_upload
if right(tmpsiteurl,1)<>"/" then tmpsiteurl=tmpsiteurl&"/"
set file=upload.file("file1")
if file.FileSize=0 then
HtmEnd "请先选择要上传的图片"
end if
filetype=getext(file.FileName)
filesize=file.FileSize
filename=file.FileName
if request.Cookies("matrix3")("matrix3_admin")<>"matrix3" then
if file.FileSize>uploadsize*1024 then
HtmEnd "文件过大 (不能超过"&uploadsize&"K)"
end if
end if
if checkext(filetype)=0 then
HtmEnd "文件格式不允许 "
end if
if file.FileSize>0 then
rnum=randnum()
filepath=uploadfolder&rnum&"."&filetype
file.SaveAs Server.mappath(filepath)
fname=tmpsiteurl&filepath
response.write "<font style=""font-size:9pt""> 图片地址:<a target=_blank href='"&fname&"'>"&fname&"</a> · <a href=""upload.htm"">继续上传</a> ·</font>"
response.write "<script>self.top.document.frames.EditBox.IMAGESelect('"&fname&"');</script>"
set rs=server.CreateObject("ADODB.RecordSet")
rs.open "m3_uploadfiles",conn,1,3
rs.addnew
rs("FileID")=rnum
rs("filename")=server.HTMLEncode(filename)
rs("filepath")=filepath
rs("filesize")=filesize
rs("filetype")=filetype
rs("username")=request.Cookies("matrix3")("matrix3_name")
rs("uploadtime")=now
rs("downloadtimes")=0
rs("bbsid")=0
rs.update
rs.close
set rs=nothing
end if
set file=nothing
set upload=nothing
call closedb()
sub HtmEnd(Msg)
set file=nothing
set upload=nothing
response.write "<center> <font size=2>"
response.write Msg&"</font>"
response.write " · <a href=""javascript:history.back();"">返回</a> ·"
response.write "</center>"
response.end
end sub
function randnum()
dim randyear,randmonth,randday
randyear=year(date)
if len(randyear)=1 then randyear="0"&randyear
randmonth=month(date)
if len(randmonth)=1 then randmonth="0"&randmonth
randday=day(date)
if len(randday)=1 then randday="0"&randday
randomize
randnum=int(900000*rnd)+100000
randnum=randyear&randmonth&randday&cstr(randnum)
end function
function getpath123(str123)
if isnull(str123) then exit function
if instr(str123,"/")>0 then
getpath123=lcase(left(str123,instrRev(str123,"/")-1))
else
getpath123=""
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -