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

📄 photo_upload.asp

📁 一个超级漂亮的班级主页asp代码
💻 ASP
字号:
<!--插入html头部分以及数据库接口-->
<!--#include file="in_conn.asp"-->
<!--#include file="UpLoadClass.asp"-->
<!--获取照片限制大小-->
<!--#include file="in_phsize.asp"-->
<!--时间转化ID的函数-->
<!--#include file="in_idtime.asp"-->

<%
Server.ScriptTimeOut=5000
%>

<body>
<!--插入网站置顶-->
<% if u_name="" then
	Response.Redirect "log_err.asp"
else
%>
<!--#include file="in_topmb.asp"-->
<% end if %>

<%
'判断用户权限
IF u_power=0 THEN
	Response.Redirect "resp.asp?cmd=id_wait"
ELSEIF u_power<0 THEN
	Response.Redirect "resp.asp?cmd=id_forbid&time="&u_fobdate
END IF
%>


<%
dim request2 
'建立上传对象
set request2=New UpLoadClass
'使用手动方式保存
request2.AutoSave=2
request2.SavePath="img/photo/"
'打开对象
request2.open()

dim vtip,vpurl
dim vpw,vph
dim vdate
dim vphidfre

'获得表单传值
vtip=trim(Request2.Form("txttip"))
vdate=now()
vphidfre=idtime(vdate)

'检查正确性
If Len(vtip)>50 Then
	Response.Redirect "resp.asp"
End If


Request2.MaxSize=DEF_phsize*1024

if Request2.Save("fphoto",0) then
		'如果上传成功
		vpurl=Request2.SavePath&Request2.Form("fphoto")
		'如果图片宽高不符界限,则
		vpw=Request2.Form("fphoto_Width")
		vph=Request2.Form("fphoto_Height")
		if isNumeric(vpw) then
			If vpw>250 or vph>250 Then
				if vpw>vph then
					vph=Cint(250 / vpw * vph)
					vpw=250
				else
					vpw=Cint(250 / vph * vpw)
					vph=250
				end if
			End If
		else
			vpw=250
			vph=250
		end if
else
	'如果上传失败
	dim vcmd
	SELECT CASE Request2.Form("fphoto_Err")
		CASE -1
			vcmd="img_notfile"
		CASE 1
			vcmd="img_toobig"
		CASE 2
			vcmd="img_type"
		CASE 3
			vcmd="img_big_type"
	END SELECT
	Response.Redirect "resp.asp?cmd="&vcmd
end if

set request2=Nothing

'开始插入数据
sqlstr="INSERT INTO tblphoto(p_author,p_tip,p_date,p_url,p_w,p_h,p_belong,p_emo,p_idfre) VALUES('"&u_name&"','"&stryin(vtip)&"',#"&vdate&"#,'"&stryin(vpurl)&"',"&vpw&","&vph&",-1,0,"&vphidfre&")"
conn.Execute sqlstr
%>


<table align="center" width="700" height="50" border="0" cellspacing="0" cellpadding="11" class="rdkuang"><tr>
	<td width="100%" height="100%" align="center">
		<table align="center" width="400" height="50" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%" height="100%">
<img src="img/jjgo.gif" border="0">
&nbsp;恭喜,上传照片成功!
url:<% =vpurl %><br>

<%
dim vnewphid
vnewphid=conn.Execute("SELECT p_ID FROM tblphoto WHERE p_idfre="&vphidfre,0,1)(0)
%>

<br>请选择接下来的操作:

<br><img src="img/icn_go.gif" border="0" align="absmiddle"><a href="javascript:history.go(-1);">返回并继续上传照片</a>
<br><img src="img/icn_go.gif" border="0" align="absmiddle"><a href="photoview.asp?id=<% =vnewphid %>" target="_blank">打开您刚刚所发布的照片页面</a>
<br><img src="img/icn_go.gif" border="0" align="absmiddle"><a href="phbook.asp">返回到班级相册头页</a>
		</td></tr></table>
	</td>
</tr></table>

<br>
<!--插入在线统计-->
<!--#include file="in_online.asp"-->
<!--插入网站置底-->
<!--#include file="in_bottom.asp"-->
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -