JSP Uploading and downloading Video

后端 未结 1 1478
名媛妹妹
名媛妹妹 2021-01-01 06:41

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 exampl

相关标签:
1条回答
  • 2021-01-01 07:06

    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.

    0 讨论(0)
提交回复
热议问题