⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 photoupload.asp

📁 用JAVA编写的网络留言簿。前台功能 一、用户注册/注册资料修改。 二、签写留言
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="session.asp" -->
<!--#include file="conn.asp" -->
<!--#include file="upload_5xsoft.inc" -->

<%
if session("photoflag")<>"1" then
	response.write"<script>alert('对不起,您没能通过管理员的认证,无权上传照片!');location='photo.asp'</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="photo"
	''在目录后加(/)
	if right(formPath,1)<>"/" then 
		formPath=formPath&"/"
	end if
	set rs=server.CreateObject("adodb.recordset")
	rs.open "photo",conn,3,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.write "<script>alert('照片上传成功!');location='photo.asp'</script>"
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 + -