Add_File.jsp
资源名称:zyp.rar [点击查看]
上传用户:zdly666
上传日期:2022-08-09
资源大小:6511k
文件大小:3k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
JavaScript
- <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
- <%@ include file="conn.jsp"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <%
- if(session.getAttribute("adminname")==null)
- {response.sendRedirect("sorry.jsp");}
- %>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>文件添加</title>
- <script language="JavaScript">
- function YanZheng()
- {
- if (myform.Column_ID.value=="")
- {alert("请选择栏目类别!");myform.Column_ID.focus();return false}
- if (myform.Title.value=="")
- {alert("标题不能为空!");myform.Title.focus();return false}
- if (myform.Synopsis.value=="")
- {alert("简介不能为空");myform.Synopsis.focus();return false}
- if (myform.Introduce.value=="")
- {alert("详细介绍不能为空");myform.Introduce.focus();return false}
- if (myform.File.value=="")
- {
- alert("请上传文件!!");
- myform.File.focus();
- return false;
- }else{
- str = myform.File.value;
- strs = str.toLowerCase();
- lens = strs.length;
- extname = strs.substring(lens-4,lens);
- if(extname!=".jpg" && extname!=".gif"&& extname!=".avi" && extname!=".wmv" && extname!=".rar"&& extname!=".doc"&& extname!=".txt")
- {
- alert("请选择正确的文件上传!");
- return false;
- }
- }
- }
- </script>
- </head>
- <body background="img/beijing.gif">
- <jsp:include page="Menu.jsp" flush="true"/>
- <br>
- <form name="myform" method="post" action="Operate_File.jsp?EditType=fileAdd" enctype="multipart/form-data" onSubmit="return YanZheng()">
- <table width="100%" height="240" border="0" align="center" cellpadding="2" cellspacing="1">
- <tr>
- <td height="25" colspan="2"><div align="center"><strong>添加文件</strong></div></td>
- </tr>
- <tr>
- <td height="25"><div align="right">栏目:</div></td>
- <td height="25">
- <%
- String columnSQL="select * from S_fileColumn";
- rs=stmt.executeQuery(columnSQL);
- %>
- <select name="Column_ID">
- <option value="">请选择类别</option>
- <%
- rs.beforeFirst();
- while (rs.next())
- {
- %>
- <option value=<%=rs.getInt("column_id")%>><%=rs.getString("column_name")%></option>
- <%
- }
- rs.close();
- rs=null;
- stmt.close();
- conn.close();
- %>
- </select>
- </td>
- </tr>
- <tr>
- <td width="275" height="33" align="right" valign="middle">标题:</td>
- <td width="689"><input name="Title" type="text" value="" size="50"></td>
- </tr>
- <tr>
- <td width="275" height="33" align="right" valign="middle">简要介绍:</td>
- <td width="689"><input name="Synopsis" type="text" size="50" maxlength="80"></td>
- </tr>
- <tr>
- <td width="275" height="33" align="right" valign="middle">详细介绍:</td>
- <td width="689"><textarea name="Introduce" cols="48" rows="5"></textarea></td>
- </tr>
- <tr>
- <td width="275" height="33" align="right" valign="middle">上传文件:</td>
- <td width="689"><input name="File" type="file" value="" size="40"></td>
- </tr>
- <tr>
- <td height="24" colspan="2" align="right" valign="middle"> <div align="center">
- <input type="submit" name="Submit1" value=" 确 定 ">
- <input type="reset" name="Submit2" value="重置" >
- </div></td>
- </tr>
- <tr>
- <td height="25" colspan="2" align="right" valign="middle"><a href="picture1.jsp">返回个人相册</a></tr>
- </tr>
- </table>
- </form>
- </body>
- </html>