异步文件上传(AJAX文件上传),使用JSP和JavaScript [英] Asynchronous file upload (AJAX file upload) using jsp and javascript
问题描述
我打算让异步文件上传。这是文件应该被上传到一个JSP或Servlet和返回的东西到HTML / JSP页面无需重新加载原来的页面。它应该发生像一个AJAX调用。有没有办法做到这一点的AJAX或任何其他方式来做到这一点。
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.
推荐答案
我不相信AJAX可以处理文件上传,但可以使用库,充分利用闪存来实现。的闪存实现的另一个优点是一次(如Gmail)做多个文件的能力。
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的是一个良好的开端: http://www.swfupload.org/documentation
SWFUpload is a good start : http://www.swfupload.org/documentation
jQuery和其他一些图书馆有插件,利用SWFUpload的。在我的最后一个项目,我们使用的SWFUpload和Java没有问题。
jQuery and some of the other libraries have plugins that leverage SWFUpload. On my last project we used SWFUpload and Java without a problem.
也乐于助人,值得研究的是Apache的文件上传: http://commons.apache.org/文件上传/ index.html的
Also helpful and worth looking into is Apache's FileUpload : http://commons.apache.org/fileupload/index.html
这篇关于异步文件上传(AJAX文件上传),使用JSP和JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!