public String createFrom ( String fileName , String base64String ) { String result ; String baseName = FilenameUtils . getBaseName ( fileName ) ; String target = saveBase + baseName ; String ext = FilenameUtils . getExtension ( fileName ) ; byte [ ] content = base64Decode ( base64String ) ; String downloadedFile = FileUtil . saveToFile ( target , ext , content ) ; String wikiUrl = getWikiUrl ( downloadedFile ) ; if ( wikiUrl != null ) { // make href to file result = String . format ( "<a href=\"%s\">%s</a>" , wikiUrl , fileName ) ; } else { result = downloadedFile ; } return result ; }
Creates a new file with content read from base64 encoded string .