fileupload1

类别:Java 点击:0 评论:0 推荐:


fileup.jsp   showKid图片类别  DBconn连接数据库

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.util.*" errorPage="" %>
<jsp:useBean id="show" scope="page" class="test.showKid"/>
<jsp:useBean id="test" scope="page" class="test.DBconn"/>
<html>
<head>
<title>MMS图片上传</title>
<%@ include file="page.css"%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Check()//检查是否为空值
{

  var name=document.all.name.value;
   if(name==""||name.length<1)
  {
    alert("图片说明不能为空");
    document.all.name.focus();
    return false;
  }
   var down=document.all.down.value;
   if(down==""||down.length<1)
  {
    alert("请输入下载次数");
    document.all.down.focus();
    return false;
  }
   var seqno=document.all.seqno.value;
   if(seqno==""||seqno.length<1)
  {
    alert("请输入图片排序");
    document.all.seqno.focus();
    return false;
  }
  return true;
}
</script>
</head>
<body>
<center>
 <table width="500" height="500">
 <form action="fileup_in.jsp" method="post" enctype="multipart/form-data" name="form1">
  <tr>
    <th height="30" colspan="3">MMS图片上传</th>
  </tr>
  <tr>
    <td height="20" colspan="3">
     图片路径:<input name="thisfile" type="file" id="thisfile">
    </td>
  </tr>
  <tr>
    <td height="20" colspan="3">
    图片类别:<%=show.showKid()%>
   </td>
  </tr>
  
   <tr>
     <td height="20" colspan="3">
     图片说明:<input type="text" class="pp" name="name" size="20">
     </td>
   </tr>
   <tr>
     <td height="20" colspan="3">
     下载次数:<input type="text" class="pp" name="down" size="20">
     </td>
   </tr>
   <tr>
     <td height="20" colspan="3">
     图片排序:<input type="text" class="pp" name="seqno" size="20">
     </td>
   </tr>
   <tr>
  <td height="20" colspan="3">
    <input type="submit" name="Submit" value="确 定" onclick='return Check()';>
     </td>
   </tr>
   </form>
   <tr>
      <td colspan="3" height="30">
      </td>
  </tr>
  <%
  int pid = show.getTop();
  int i = 0;
  Object tmpid;
  Object pixid;
  Object pic_url;
  ArrayList al = new ArrayList();
  try {
  String sql = "select pid,pixid,pic_url from picturelib where pid="+pid+" order by pixid desc";
  ResultSet rs = test.executeQuery(sql);
   while (rs.next())
   {
   tmpid = rs.getString(1);
   pixid = rs.getString(2);
   pic_url = rs.getString(3);
      al.add(0,tmpid);
   al.add(1,pixid);
   al.add(2,pic_url);
   i++;
      }
  
  }
  catch(Exception e)
  {
   System.out.println("sql error");
  }
 //System.out.println(al.size());
  %>
  <form action="fileup2_in.jsp" method="post" enctype="multipart/form-data" name="form1"> 
       <tr>
      <td width="351" height="60">
  <input type="hidden" name="id" value="<%=pid%>">
     30 X 30px:&nbsp;&nbsp;       <input type="hidden" name="pixid" value="1"><input name="thisfile" type="file" id="thisfile">
  </td>
   <td width="137">
   <%if (al.size()>2){%>
   <img src="<%="images/"+al.get(2)%>" width="60" height="60">
     <%}%>
  </td>
  </tr>
  <tr>
    <td height="60">
  <input type="hidden" name="id" value="<%=pid%>">
    128 X 128px:<input type="hidden" name="pixid" value="2">
      <input name="thisfile2" type="file" id="thisfile2"></td>
   <td width="137">
   <%if (al.size()>5){%>
   <img src="<%="images/"+al.get(5)%>" width="60" height="60">
    <%}%>
 </td>
  </tr>
  
   <tr>
    <td height="60">
    <input type="hidden" name="id" value="<%=pid%>">
     160 X 128px:<input type="hidden" name="pixid" value="3">
       <input name="thisfile3" type="file" id="thisfile3"></td>
    <td width="137">
 <%if (al.size()>8){%>
  <img src="<%="images/"+al.get(8)%>" width="60" height="60">
    <%}%>
 </td>
   </tr>
   <tr>
     <td height="60">
   <input type="hidden" name="id" value="<%=pid%>">
     160 X 150px:<input type="hidden" name="pixid" value="4">
       <input name="thisfile4" type="file" id="thisfile4"></td>
    <td width="137">
  <%if (al.size()>11){%>
   <img src="<%="images/"+al.get(11)%>" width="60" height="60">
      <%}%>
    </td>
   </tr>
  <tr>
  <td height="20" colspan="2">
    <input type="submit" name="Submit" value="确 定">
    </td>
   </tr>
  </form>
  <tr>
      <td colspan="2">
      </td>
  </tr>
</table>

</center>
</body>
</html>

 

本文地址:http://com.8s8s.com/it/it13955.htm