Package com.ponxu.run.web.FileUpload

Examples of com.ponxu.run.web.FileUpload.FilePart


  }

  // 上传
  public void post() {
    FileUpload fileUpload = new FileUpload(request());
    FilePart filePart = fileUpload.getFilePart(FILEDATA_NAME);

    String fileName = filePart.getFileName();
    File f = new File(fileName);
    fileName = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())
        + f.getName();

    if (Config.isCloudFoundry) {
      // CloudFoundry 使用mongodb
      MongoDAO.saveFile(fileName, filePart.getFileContent());
    } else {
      // 直接写入本地存储(SAE FileWrap)
      try {
        FileOutputStream out = new FileOutputStream(
            getSavePath(fileName));
        out.write(filePart.getFileContent());
        out.flush();
        out.close();
      } catch (Exception e) {
        LOG.error(e.getMessage(), e);
      }
View Full Code Here

TOP

Related Classes of com.ponxu.run.web.FileUpload.FilePart

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.