my program is meant to load an image, resize it, save it, send it to FTP server and then delete resized image. Full code - HERE
The problem I am encountering is after pressing a finish button from the file named AddBreedBuilder.java: program sends resized file to server, freeze for ~1 sec, and it is trying to remove resized file (but it is not possible).
I tried to use (at the moment this part is deleted from java file, line 165): File fileToDelete = new File(imgPath);
boolean success = fileToDelete.delete();
but success
is always false
. Only way to delete this file is to not run sendToFTP()
.
From what I think, my program is using this file during file delete operation, so it cannot be deleted.
My question is: is it possible to delay file delete till program unfreeze? Or maybe there is way to send resized file without saving it?