Package org.springframework.web.multipart

Examples of org.springframework.web.multipart.MultipartFile.transferTo()


    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        FileUploadForm form = (FileUploadForm) command;
        String uploadDir = form.getUploadDir();
        MultipartFile file = form.getFile();
       
        file.transferTo(new File(uploadDir + File.separator + file.getOriginalFilename()));
       
        return new AjaxModelAndView(this.getSuccessView(), errors);
    }
}
View Full Code Here


            //    if (!item.isFormField()) { 
                      
                    String uploadPath = ImageUtils.getUploadPath();
                    String sourcePath = uploadPath + System.getProperty("file.separator") + "gatewayGategoryDetail" + System.currentTimeMillis() +".jpg";
               
                    file.transferTo(new File(sourcePath));
               
                String[] path = sourcePath.split("\\"+System.getProperty("file.separator"));
                    sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
                 
                  PrintWriter out = response.getWriter();
View Full Code Here

    MultipartFile   file   =   maps.get(key);
      try
             String uploadPath = ImageUtils.getUploadPath();
             String sourcePath = uploadPath + System.getProperty("file.separator") + new Date().getTime()+"_"+merchant.getID()+".jpg";
             File newFile = new File(sourcePath);
             file.transferTo(newFile);
         return newFile;
        } catch (Exception e) { 
            e.printStackTrace()
        }
        return null;
View Full Code Here

             name = productImage.getDate().getTime()+"";
             productImage.setName(name);
            
             String uploadPath = ImageUtils.getUploadPath();
             String sourcePath = uploadPath + System.getProperty("file.separator") + name+".jpg";
             file.transferTo(new File(sourcePath));
       
         String[] path = sourcePath.split("\\"+System.getProperty("file.separator"));
             sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
             productImage.setSourceURL(sourcePath);
             return productImage;
View Full Code Here

        list.add(index,FILE_PHY_NAME, phyName);
      }
      String filePath = properties.getProperty("baseDir").replaceAll("\\\\", "/") + SEPERATOR + path + SEPERATOR + list.getString(index, FILE_PHY_NAME);
      filePath = filePath.replaceAll("\\\\", "/");
      if (mFile.getSize() > 0) {
        mFile.transferTo( new File(filePath) );
      }
     
      if(filter(list.getString(index, EXTENTION))) {
        index++;
        list.remove(index);
View Full Code Here

        File uploadedFile = File.createTempFile("preview", "", new File(siteConfig.getPathPrefix() + "/linux-storage/tmp/"));
        String image = uploadedFile.getPath();
        if ((uploadedFile.canWrite() || uploadedFile.createNewFile())) {
          try {
            logger.debug("Transfering upload to: " + image);
            multipartFile.transferTo(uploadedFile);
            return image;
          } catch (Exception e) {
            throw new ScriptErrorException("Failed to write uploaded file", e);
          }
        } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.