编程语言

img ziying

commonfileupload

发表于2004/10/28 10:47:00  892人阅读

分类: jsp

 fileup.jsp   showKid 图片类别bean   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"%>
</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="确 定">
     </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+"";
  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");
  }
 file://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>

fileup.jsp   file://showKid  图片类别bean   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"%>
</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="确 定">
     </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+"";
  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");
  }
 file://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>
</table>

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

阅读全文
0 0

相关文章推荐

img
取 消
img