一个很好的班级同学录

源代码在线查看: upload.asp

软件大小: 190 K
上传用户: tiantianyuehui
关键词: 同学录
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
								if session("username")="" then
				   response.redirect "index.asp"
				end if
				
				set upload=new upload_5xsoft
				phototitle=replace(trim(upload.Form("phototitle")),"'","")
				photointro=replace(trim(upload.Form("photointro")),"'","")
				set file=upload.file("photopath")
				fileExt=lcase(right(file.filename,4))
				
				if fileEXT".gif" and fileEXT".jpg" then
				 	response.write"alert('文件格式不对,请重新上传!');location='"&request.ServerVariables("HTTP_REFERER")&"'"
					response.end
				end if 
				
				if file.fileSize>0 then
					formPath="upphoto/"
					sql="select * from photo"
					set rs=server.CreateObject("adodb.recordset")
					rs.open sql,secondconn,1,3
					rs.addnew
					
					filename = makefilename(now()) & "." & GetExtendName(file.FileName)
					file.SaveAs Server.mappath(formPath&filename)   ''保存文件
					
					rs("photoauthor")=session("username")
					rs("phototitle")=phototitle
					rs("photointro")=photointro
					rs("photofilename")=filename
					rs("phototime")=now()
					rs.update
					response.Redirect("index.asp")
				end if
				set file=nothing
				set upload=nothing
				
				function makefilename(filename)
				  filename = now()
				  filename = replace(filename,"-","")
				  filename = replace(filename," ","") 
				  filename = replace(filename,":","")
				  filename = replace(filename,"PM","")
				  filename = replace(filename,"AM","")
				  filename = replace(filename,"上午","")
				  filename = replace(filename,"下午","")
				  makefilename=filename
				end function 
				function GetExtendName(FileName)
				  dim ExtName
				  ExtName = LCase(FileName)
				  ExtName = right(ExtName,3)
				  ExtName = right(ExtName,3-Instr(ExtName,"."))
				  GetExtendName = ExtName
				end function
				%>			

相关资源