JSP上传下载视频 [英] JSP Uploading and downloading Video

查看:9
本文介绍了JSP上传下载视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个允许管理员下载和上传视频的网站.谁能指导我怎么做?它与上传和下载图像相同吗?任何网站都有例子吗?

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?

推荐答案

上传也可以这样.您基本上只需要在服务器端得到一个 InputStream ,然后将其写入您想要的任何 OutputStream ,例如FileOutputStream 将其存储在本地磁盘文件系统中.下载的方式也基本相同,只需要相应地更改Content-Type 标头以表示正确的内容类型,以便浏览器知道如何处理它.

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.

Apache Commons FileUpload 的帮助下,可以轻松地处理 Servlet 的文件上传.这是一个基本示例.借助 Servlet 可以轻松完成下载,该 Servlet 以 InputStream 形式获取文件,并以通常的 Java IO 方式将其写入响应的 OutputStream.这是一个基本示例.

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.

这篇关于JSP上传下载视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆