I am currently building a website using JSP/Servlets, n that I wanted to add a page where user's can add new videos as well as view the videos.
I have no idea as to how to go about with the code as well as how to store the video files and format, etc.
Kindly help me.
Joined: Mar 24, 2005
On the input side you need to build a form which accepts files. The servlet which processes the form will download the file (there are plenty of examples of this on the internet), and save it somewhere - more on that later. The servlet should also do validation to make sure this file is not malicious (i.e. only allow certain file extensions to be uploaded, like .avi), if you have any size restrictions (and you should), those should also be enforced, etc.
On the output side, you need a page which displays file references (i.e. names) and links to the actual files for download. Depending on where you store the files, you might need another servlet which actually sends the files over, it has to have access to the files and basically opens a stream and sends it over to the client.
As far as storage is concerned, you have two choices - filesystem or database. Since these are videos, the files will be relatively large, so I would recommend filesystem storage. You can store the file references in the database for quick lookup, but you can also just always search the directories, especially if you organize them well. The files themselves have to be in a location that is accessible to your app server.