web services - Absolute path in Spring Boot -


i'm using spring boot , created web service photos upload. saving files, used absolute path "/uploads", signals location's not exist, processed using java path, src/... in local server, that's working well, after hosting on heroku server, images not uploading. after adding elements, src of pictures not exist.

this webservice:

//image ///////////////////////////////////////////////////////////////////// private final logger log = loggerfactory.getlogger(this.getclass()); @postmapping("/") @requestmapping(value="/transfererimage", method = requestmethod.post) public void transfererimage(@requestparam("file") multipartfile file, @requestparam("nom") string nom) throws exception{     string nomfichier="";     try {         nomfichier = nom;         byte[] bytes = file.getbytes();         classloader classloader = getclass().getclassloader();         bufferedoutputstream bufferedoutputstream = new bufferedoutputstream (new fileoutputstream(new file("src/main/resources/static/images/"+nomfichier)));         bufferedoutputstream.write(bytes);         bufferedoutputstream.close();        } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();         log.info("une erreur est produite lors de la lecture de fichier"+ nomfichier);     }  } 

thank you


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -