1

I'm currently developing a Tracking System with JavaFX and MySQL as database that is kept in a server. My application is used within a network and allows users to upload and download pictures and several types of document.

My question: What is the best way to send and retrieve files to a server within a network? And should I store those files in MySQL or just their paths in MySQL? If only files' paths, do I need FTP or other techniques? I need detail answer because it is my first time to develop such application.

Edit: I want to store data in a server. I build this application for client machines so that clients can keep documents in the server and they can access their files from any machines... I have no idea for how to transfer files from client machines to server. Please help me!

rathaROG
  • 31
  • 9
  • You can create a RESTFul web service for file upload and download. You can call those HTTP methods using Apache http client. – Pasupathi Rajamanickam Jul 29 '15 at 05:25
  • You need detail answer, then you need to provide more specific requirements. I would think you will get more questions than answers. Meanwhile, you may refer to a similar question here: http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay – o.k.w Jul 29 '15 at 10:33
  • I want to store data in a server. I build this application for client machines so that clients can keep documents in the server and they can access their files from any machines... I have no idea for how to transfer files from client machines to server. Please help me! – rathaROG Aug 02 '15 at 12:03

1 Answers1

0

You should use socket programming like what is at following link: http://www.rgagnon.com/javadetails/java-0542.html .But if you are using Java7, Files is the best one instead of BufferedInputStream or FileInputStream (No extra library require):

/* You can get Path from file also: file.toPath() */
Files.copy(InputStream in, Path target)
Files.copy(Path source, OutputStream out)
user3359139
  • 430
  • 4
  • 17
  • Thanks for your answer! I'll test it in my office next week and I'll tell you if it's working fine. – rathaROG Aug 02 '15 at 11:59