?? photo_upload.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">
恭喜,上傳照片成功!
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 + -