1
I’m trying to make a program that controls the information of students in a school.
One of the functions of this program is to archive scanned student documents, but it’s precisely in this part that I’m having trouble.
I want to use a Jfilechooser to choose the file to be saved, then copy that file to a particular folder and save both the file name and its path to a DB.
I need an example/handout on the subject, because I only found material aimed at WEB applications.
Thanks for your help!
Have you ever thought about turning this file into binary and saving it to BD that way, if you need that file again, you have to create a method/function that turns these binaries into a file again. So in case the file gets deleted by someone, problem on the machine where those files are saved you don’t lose the information.
– Diego Farias
It’s simple, try to go in pieces, first upload the file and send it to a directory. Then take the file information and the directory in which it was saved and save it all in the bank. At the time of recovering the file just go in the directory and search the same.
– DiegoAugusto
so my difficulty is precisely in the upload part, there is some function library just for file manipulation?
– Victor Piovani
@Victorpiovani check it out, http://stackoverflow.com/questions/1146153/copying-files-from-one-directory-to-another-in-java
– DiegoAugusto
You can use the
FileUtils
ofapache commons-io
, then just pass the file you uploaded and the destination. Example:FileUtils.copyDirectory(jFileChooser.getSelectedFile(), "C:\\novosArquivos");
– DiegoAugusto