public String save(String uploadFolder) throws ControllerException {
         String realPath = info.getRealPath(uploadFolder);

         fn.sanitise();

         String imagename = uniqueImagename(realPath, fn.fullPath());
         try {
             ImageIO.write(image, fn.extension(), new File(realPath, imagename));
             image.flush();
         } catch (IOException e) {
             throw new ControllerException(e);
         }
         return uploadFolder + File.separatorChar + imagename;
     }
public String save ( String uploadFolder ) throws ControllerException { String realPath = info . getRealPath ( uploadFolder ) ; fn . sanitise ( ) ; String imagename = uniqueImagename ( realPath , fn . fullPath ( ) ) ; try { ImageIO . write ( image , fn . extension ( ) , new File ( realPath , imagename ) ) ; image . flush ( ) ; } catch ( IOException e ) { throw new ControllerException ( e ) ; } return uploadFolder + File . separatorChar + imagename ; }
Saves the file on the server in the folder given

@param uploadFolder
@return The server path to the saved file.
@throws ControllerException If anything goes wrong during write to disk.