📄 photoupload.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="session.asp" -->
<!--#include file="conn.asp" -->
<!--#include file="incUpload.asp" -->
<%
'=========================================================
' File: index.asp
' Version:1.1
' Date: 2003-8-3
' Script Written by allen
'Design by Fox
'=========================================================
' Copyright (C) CNMAYA.ORG. All rights reserved.
' Web: http://www.cnmaya.org,http://www.itmaya.com
' Email: allenzyk@cnmaya.org
'=========================================================
if session("usergroup")=1 then
response.write"<script>alert('对不起,您还没有经过同学验证,无权发布消息!');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end
end if
set upload=new upload_5xsoft
phototitle=replace(trim(upload.Form("phototitle")),"'","")
photocomment=replace(trim(upload.Form("photocomment")),"'","")
set file=upload.file("photo")
fileExt=lcase(right(file.filename,4))
if fileEXT<>".gif" and fileEXT<>".jpg" then
response.write"<script>alert('文件格式不对,请重新上传!');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end
end if
if file.fileSize>0 then
formPath="upload/"
set rs=server.CreateObject("adodb.recordset")
rs.open "photo",conn,1,3
rs.addnew
vfname = makefilename(now())
fname = vfname & "." & GetExtendName(file.FileName)
file.SaveAs Server.mappath(formPath&fname) ''保存文件
rs("photouser")=session("username")
rs("phototitle")=phototitle
rs("photocomment")=photocomment
rs("photoname")=fname
rs("phototime")=now()
rs.update
response.Redirect("photo.asp")
end if
set file=nothing
set upload=nothing
function makefilename(fname)
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
makefilename=fname
end function
function GetExtendName(FileName)
dim ExtName
ExtName = LCase(FileName)
ExtName = right(ExtName,3)
ExtName = right(ExtName,3-Instr(ExtName,"."))
GetExtendName = ExtName
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -