I created a photo upload on my system, these photos are saved in a temp, I need to move them to a default directory, other than temp.
This is the method that creates the directory:
public FotoStorageLocal() {
//Versao MAC
//this(getDefault().getPath(System.getenv("user.home"), ".genesisfotos"));
// versao windows
this(getDefault().getPath(System.getProperty("user.home"), ".genesisfotos"));
System.out.println(">>>>>>>> CRIADO GENESIS + FOTOS ");
}
public FotoStorageLocal(Path path) {
this.local = path;
criarPastas();
}
And this is the method that makes the photo saved and then transferred from the temp folder to the default directory.
I run the system but it can not take the photo from the folder it has to another folder, follow code
public void salvar(String foto) {
try {
Files.move(this.localTemporario.resolve(foto), this.local.resolve(foto));
} catch (IOException e) {
throw new RuntimeException("Erro movendo a foto para destino final", e);
}
try {
Thumbnails.of(this.local.resolve(foto).toString()).size(40, 68).toFiles(Rename.PREFIX_DOT_THUMBNAIL);
} catch (IOException e) {
throw new RuntimeException("Erro gerando thumbnail", e);
}
}