String fileLocation = new File("srcmain esourcesstaticuploads").getAbsolutePath() + "" + fileName; FileOutputStream output = new FileOutputStream(fileLocation); output.write(imagem.getBytes()); output.close();