Download and save a file from the web using JAVA

March 26, 2016 | 438 views | Comments

Use the method copyURLToFile of the class FileUtils to download and save files from the internet in JAVA. Images can also be saved using this function.

 

URL url = new URL("http://DOMAIN/PATH_TO/IMAGE");
File savedFile = new File("/LOCAL_PATH/NEW_IMAGE_NAME");
FileUtils.copyURLToFile(url, savedFile);

Related Tutorials


Must Read