JSP Uploading and downloading Video

瘦欲@ 提交于 2019-11-30 10:46:51
BalusC

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!