www.gusucode.com > 新锐领秀网络相册 1.1 > admin/post-.asp

    <!-- #Include File="../conn.asp"-->
<!--#include file="../include/const.asp"-->
<!--#include file="../include/clsUp.asp"-->
<!--#include file="../include/aspjpeg.asp"-->
<!--#include file="../include/function.asp"-->
<!-- #Include File="inc/const.asp" -->
<!--#include file="admin_func.asp"-->
<%
CheckAdmin
Dim action
action = Request.QueryString("action")
If action = "add_save" Then 
	Dim title,photopath,thumbphotopath,Content,typeid,hot,rs,sql,FileName
	
	set upfile=new clsUp ''建立上传对象
	upfile.NoAllowExt="asp;exe;htm;html;aspx;cs;vb;js;"	'设置上传类型的黑名单
	upfile.GetData (10240000)   '取得上传数据,限制最大上传10M
	
	FileName = gMakeFileName(now())
	
	
	If UploadThumb = 1 And Not IsObjInstalled(gJpeg) Then
		Set oFile=upfile.f_i_l_e("thumbphotopath")
		thumbphotopath  = FileName & "_thumb." & oFile.FileExt
		upfile.SaveToFile "thumbphotopath",Server.mappath("../photos/" & thumbphotopath)
		Set oFile = Nothing
	End If
	Set oFile=upfile.f_i_l_e("photopath")
	photopath = FileName &"." & oFile.FileExt
	upfile.SaveToFile "photopath",Server.mappath("../photos/" & photopath)
	Set oFile = Nothing
	If IsObjInstalled(gJpeg) Then 
		'Dim Thumb
		thumbphotopath = FileName & ".thumb." & oFile.FileExt
		gCreateSmallImg Server.mappath("../photos/" & photopath),Server.mappath("../photos/" & thumbphotopath),gThumbMaxWidth,gThumbMaxHeight,1 
	End If
	set upfile = Nothing 
	title=gCheckStr(upfile.form("title"))
	Content=trim(gCheckStr(upfile.form("Content")))
	typeid=gCheckStr(upfile.form("typeid"))
	set rs=server.createobject("adodb.recordset")
	If Not IsObject(conn) Then Call Connectiondatabase
	sql="select * from gPhotos where id is null"
	rs.open sql,conn,1,3
	rs.addnew
	rs("Title")=title
	rs("ThumbPhotoPath")=thumbphotopath
	rs("PhotoPath")=photopath
	Rs("DateLine")=Now()
	'rs("Description")=Content
	rs("TypeID")=typeid
	rs.update
	rs.close
	set rs=Nothing
	response.write"<script language='javascript'>alert('系统提示:图片添加成功!')</script>"
	response.Write "<meta http-equiv=refresh content=0;URL=post.asp>"
	response.end
End If 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>九星燃具</title>
<link href="../images/admincp/admincp.css" rel="stylesheet" type="text/css">
</head>
<body>
<script language="javascript">
function Check_form()
{
	if(myform.title.value=="")
	{
		alert("请输入标题!");
		myform.title.focus();
		return false;
	 }
	 if(myform.typeid.value=="")
	 {
		alert("请选择类型!");
		myform.typeid.focus();
		return false;
	 }

}
</script>
<table width="100%"class="tableborder" align="center">
	<tr class="header">
		<td height="20" width="100%">添加图片</td>
	</tr>
</table>
<table width="100%" class="tableborder" align="center">
    <form method="post" action="?action=add_save" name="myform" ENCTYPE="multipart/form-data" onSubmit="return Check_form();"> 
	 <tr>
      <td width="100%" valign="top" align="center">
      <table width="100%" class="tableborder">
        <tr class="tr2">
          <td align=left colspan="2"><b><font color="#0C338F">请在以下窗口中完整输入信息内容:</font></b></td>
        </tr>
        <tr>
          <td width="200" align=right><font color="#0C338F">图片标题</font></td>
          <td align="left"><input type="text" name="title" size="20"></td>
        </tr>
        <tr>
          <td align="right"><font color="#0C338F">图片分类</font></td>
          <td align="left"><select name="typeid" size="1"><option selected value="">-请选择类别-</option><%gPhotoTypeSelect(0)%></select></td>
        </tr>
		<%If UploadThumb = 1 And Not IsObjInstalled(gJpeg) Then%>
		<tr >
          <td align="right"><font color="#0C338F">选择缩略图</font></td>
          <td align="left"><input type="file" name="thumbphotopath">
        </td> 
		</tr>
		<%End If%>
        <tr >
          <td align="right"><font color="#0C338F">选择图片</font></td>
          <td align="left"><input type="file" name="photopath">
        </td> 
        </tr>
        <tr>
          <td width="200" align="right" valign="top">
          <font color="#0C338F">图片说明</font></td>
          <td width="86%" align="left">
			<textarea name="content" rows="8" cols="40"></textarea>
		  </td></tr>
        <tr class="tr2">
          <td height="12" colspan="2" >
          <p align="center">          
          <input type="submit" value="确定增加" name="submit3" class=buttonface>
          <input type="reset" value="清空" name="Reset2" class=buttonface></td>
        </tr>
      </table>
      </td>
    
    <tr>
      <td width="100%" height="12"></td>
    </tr>
</form>    
</table>

</body>
</html>