upload_add.jsp
上传用户:yatiankong
上传日期:2014-05-16
资源大小:5604k
文件大小:1k
源码类别:

Applet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <jsp:useBean id="upload" class="MyFly.Bean.Upload" scope="request"/>
  3. <%@ page import="java.util.Date,java.text.SimpleDateFormat"%>
  4. <%@ page import="com.jspsmart.upload.*"%>
  5. <body>
  6. <%
  7.    request.setCharacterEncoding("gb2312");
  8.    String str=request.getRealPath("/");
  9.    str+="\upload";
  10.    SmartUpload mySmartUpload=new SmartUpload();
  11.    mySmartUpload.initialize(pageContext);
  12.  
  13.   mySmartUpload.setTotalMaxFileSize(1000000000);
  14.   mySmartUpload.upload();
  15.   mySmartUpload.save("/upload",mySmartUpload.SAVE_VIRTUAL);
  16.   
  17.    //Math.random();
  18.    //Integer.
  19.    //String.
  20.    String detail=mySmartUpload.getRequest().getParameter("detail");
  21.     
  22.    File maxpic=mySmartUpload.getFiles().getFile(0);
  23.    String name=maxpic.getFileName();
  24.  SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式. 
  25.      Date currentTime_1 = new Date(); 
  26.      String up_time = formatter.format(currentTime_1);
  27.  
  28.  upload.setDetail(detail);
  29.  upload.setName(name);
  30.  upload.setUp_time(up_time);
  31.  
  32. if(upload.addNew() == 1)
  33. {
  34.      out.println("<script language=javascript>location.href='upload_edit.jsp';</script>");
  35.  
  36. }
  37. else
  38. {
  39.    out.println("<Script language=JavaScript>alert('添加失败,请重新修改');JavaScript:history.back();</Script>");
  40. }
  41. %>
  42. </body>
  43. </html>