views:

104

answers:

1

I want to design a website that allows an admin to download and upload video. Can anyone guide me how to do it? Is it same as upload and download image? Any site have example?

+1  A: 

Uploading can be done the same way. You basically just need to end up with an InputStream in the server side which you then write to any OutputStream you want, e.g. FileOutputStream to store it at local disk file system. Downloading is basically also the same way, you only need to change the Content-Type header accordingly to represent the correct content type so that the browser knows what to do with it.

Processing the file upload a Servlet can be done easy with help of Apache Commons FileUpload. Here's a basic example. Downloading can be done easy with help of a Servlet which obtains the file as InputStream and writes it to OutputStream of the response the usual Java IO way. Here's a basic example.

BalusC
Hi thanks for your answer, will try to work on it.