Package com.jspsmart.upload

Examples of com.jspsmart.upload.SmartUpload


  protected void doGet(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
    String temp_p = request.getParameter("downloadFileName");
    byte[] temp_t = temp_p.getBytes("UTF-8");
    String fileName = new String(temp_t, "UTF-8");
    SmartUpload mySmartUpload = new SmartUpload();
    try {
      // 初始化
      mySmartUpload.initialize(config, request, response);
      // 设置不自动打开
      mySmartUpload.setContentDisposition(null);
      mySmartUpload.downloadFile("/upload/" + fileName);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


    out.println("<H1>jspSmartUpload : Servlet Sample</H1>");
    out.println("<HR>");
    // 变量定义
    int count = 0;
    // 创建一个SmartUpload类
    SmartUpload mySmartUpload = new SmartUpload();
    try {
      // 初始化
      mySmartUpload.initialize(config, request, response);
      // 上传
      mySmartUpload.upload();
      for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
        com.jspsmart.upload.File myfile = mySmartUpload.getFiles()
            .getFile(i);
        String fileName = myfile.getFileName();
        // 保存
        count = mySmartUpload.save("/upload");
        // count = mySmartUpload.save(null);
      }
      out.println(count + " file uploaded.");
    } catch (Exception e) {
      out.println("Unable to upload the file.<br>");
View Full Code Here

TOP

Related Classes of com.jspsmart.upload.SmartUpload

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.