question: private void addProfile ( MultipartHttpServletRequest request , ModelMap model ) { List < String > lines = new ArrayList < > ( ) ; MultipartFile mpf = request . getFile ( "file" ) ; if ( mpf != null ) { String message = "" ; String filename = mpf . getOriginalFilename ( ) ; try { File tempFile = File . createTempFile ( "profile" , null ) ; mpf . transferTo ( tempFile ) ; boolean exResult = execute ( VALIDATE_CMD , tempFile , lines ) ; if ( exResult ) { filename = getNextVersionedFilename ( filename ) ; File newFile = new File ( profileDir , filename ) ; FileUtils . moveFile ( tempFile , newFile ) ; model . addAttribute ( "success" , true ) ; message = "Success adding profile: " ; } else { model . addAttribute ( "success" , false ) ; message = "Error adding profile: " ; } } catch ( Exception e ) { model . addAttribute ( "success" , false ) ; message = "Problem saving uploaded profile: " ; lines . add ( e . getMessage ( ) ) ; log . error ( "Problem saving uploaded profile" , e ) ; } finally { model . addAttribute ( "operation" , "add" ) ; model . addAttribute ( "message" , message + filename ) ; model . addAttribute ( "filename" , filename ) ; model . addAttribute ( "output" , StringUtils . join ( lines , "\n" ) ) ; } } }
target:  Handles an uploaded profile. 