I am looking for varies ways to upload a PDF file to a Linux Web Server using jsp or Servlets and then later download the file from the server.
My options are:

1. Upload the file to a Server (to a specific path or folder) and Store a URL to the file in the MySQL database and it can be downloaded easliy.

Unfortunately this method did not work for me and It failed. I used the method from an API from the site javazoom.net (UploadBean). The problem was that it did not upload the file to the correct PATH I wanted and Loaded to a dir on the Tomcat Server.

My second option is:
1. Upload the file to a Database as Binary and Then Download it, The problem is that I dont how to do it and even If I can upload the file in Binary form into the Database I want to download the file Back into its Original PDF Form.

What I am mostly looking for is Sample Code or link to good Thread from anysite that will solve my problems using the Above options or any other efficient Option.

Thanks in advance