JSP Download and Download Video

I want to create a website that allows an administrator to upload and download videos. Can someone guide me how to do this? Is it the same as uploading and uploading an image? Is there an example on any site?

+3
source share
1 answer

Download can be performed in a similar way. Basically you just need to point InputStreamto the server side, which you then write to whatever OutputStreamyou want, for example. FileOutputStreamto save it to the local file system on disk. The download is also basically the same, you only need to change the title Content-Typeaccordingly to present the correct type of content so that the browser knows what to do with it.

Servlet file upload processing can be easily done using Apache Commons FileUpload . Here is a basic example . Downloading can be done easily with the help of a servlet that receives the file InputStreamand writes it to the OutputStreamresponse in the usual way of Java IO. Here is a basic example .

+2

Source: https://habr.com/ru/post/1747557/


All Articles