Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Add/Delete and View Videos Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Add/Delete and View Videos" Watch "Add/Delete and View Videos" New topic
Author

Add/Delete and View Videos

Aniketh Narayanan
Greenhorn

Joined: Jan 05, 2013
Posts: 12
Hi,

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.

Thanks
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Add/Delete and View Videos