upload_add.jsp
资源名称:shop.rar [点击查看]
上传用户:yatiankong
上传日期:2014-05-16
资源大小:5604k
文件大小:1k
源码类别:
Applet
开发平台:
Java
- <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
- <jsp:useBean id="upload" class="MyFly.Bean.Upload" scope="request"/>
- <%@ page import="java.util.Date,java.text.SimpleDateFormat"%>
- <%@ page import="com.jspsmart.upload.*"%>
- <body>
- <%
- request.setCharacterEncoding("gb2312");
- String str=request.getRealPath("/");
- str+="\upload";
- SmartUpload mySmartUpload=new SmartUpload();
- mySmartUpload.initialize(pageContext);
- mySmartUpload.setTotalMaxFileSize(1000000000);
- mySmartUpload.upload();
- mySmartUpload.save("/upload",mySmartUpload.SAVE_VIRTUAL);
- //Math.random();
- //Integer.
- //String.
- String detail=mySmartUpload.getRequest().getParameter("detail");
- File maxpic=mySmartUpload.getFiles().getFile(0);
- String name=maxpic.getFileName();
- SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式.
- Date currentTime_1 = new Date();
- String up_time = formatter.format(currentTime_1);
- upload.setDetail(detail);
- upload.setName(name);
- upload.setUp_time(up_time);
- if(upload.addNew() == 1)
- {
- out.println("<script language=javascript>location.href='upload_edit.jsp';</script>");
- }
- else
- {
- out.println("<Script language=JavaScript>alert('添加失败,请重新修改');JavaScript:history.back();</Script>");
- }
- %>
- </body>
- </html>