使用jsp和javascript的异步文件上传(AJAX文件上传) [英] Asynchronous file upload (AJAX file upload) using jsp and javascript

查看:32
本文介绍了使用jsp和javascript的异步文件上传(AJAX文件上传)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算进行异步文件上传.也就是说,文件应该上传到 jsp 或 servlet,并在不重新加载原始页面的情况下将某些内容返回到 html/jsp 页面.它应该像 AJAX 调用一样发生.有没有办法在 AJAX 或任何其他方式中做到这一点.

解决方案

我不相信 AJAX 可以处理文件上传,但这可以通过利用 Flash 的库来实现.Flash 实现的另一个优点是能够一次处理多个文件(如 gmail).

SWFUpload 是一个好的开始:http://www.swfupload.org/documentation

jQuery 和其他一些库有利用 SWFUpload 的插件.在我的上一个项目中,我们毫无问题地使用了 SWFUpload 和 Java.

同样有用且值得研究的是 Apache 的 FileUpload:http://commons.apache.org/fileupload/index.html

I am planning on having asynchronous file uploads. That is the file should be uploaded to a jsp or servlet and return something to the html/jsp page without reloading the original page. It should happen like an AJAX call. Is there any way to do it in AJAX or any other way to do it.

解决方案

I don't believe AJAX can handle file uploads but this can be achieved with libraries that leverage flash. Another advantage of the flash implementation is the ability to do multiple files at once (like gmail).

SWFUpload is a good start : http://www.swfupload.org/documentation

jQuery and some of the other libraries have plugins that leverage SWFUpload. On my last project we used SWFUpload and Java without a problem.

Also helpful and worth looking into is Apache's FileUpload : http://commons.apache.org/fileupload/index.html

这篇关于使用jsp和javascript的异步文件上传(AJAX文件上传)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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