Javascript文件上传机制
我需要用户在不离开当前网页的情况下上传文件(主要是图像)。执行此操作的最佳工具、库或机制是什么?我正在使用最新的 jQuery 和 Spring webmvc(带有 JSP),所以如果它们内部已经有一个机制那么这是理想的。
如果有某种进度条那就太好了。这是否意味着它需要与服务器协调才能读取进度(Spring 必须发挥作用)?或者 JavaScript 中有一个机制可以实现这一点吗?
I need for users to upload files (mostly images) without leaving the current webpage. What's the best tool, library or mechanism for doing this? I'm using the latest jQuery and Spring webmvc (with JSP), so if there's already a mechanism within them then that's ideal.
It would also be really great to have some kind of progress bar. Does that mean it requires coordination with the server to read the progress (where Spring would have to come into play)? Or is there a mechanism within JavaScript for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该查看 Plupload。
真的很整洁!这是他们的一些演示的链接...
http://www.plupload.com/example_jquery_ui.php
...以及 jQuery UI 队列小部件的屏幕截图(它有一个进度条!):
我希望这有帮助。
赫里斯托
You should check out Plupload.
Its really neat! Here's a link to some of their Demos...
http://www.plupload.com/example_jquery_ui.php
... and a screenshot of the jQuery UI queue widget (it has a progress bar!):
I hope this helps.
Hristo
我经常使用 uploadify:http://www.uploadify.com/
但是它确实使用 flash 进行上传机制,因此如果用户经过身份验证可能会产生一些问题。
I use uploadify pretty regularly: http://www.uploadify.com/
However it does use flash for the upload mechanism and as a result may create some issues if the user is authenticated.
您应该在客户端使用 AJAX
http://www.webtoolkit.info/ajax-file -upload.html 本教程涵盖所有客户端。
OM 服务器端
本教程涵盖了此问题的大部分内容:
http://www.ioncannon.net/programming/975/spring-3-file-upload-example/" rel="nofollow">http://www. ioncannon.net/programming/975/spring-3-file-upload-example/
Yopu 也可以使用 jquery 或任何其他 JS 框架。
但最重要的是你需要记住你在客户端的标签应该有。
财产。这意味着您的请求包含多部分数据。
You should use AJAX on the client side
http://www.webtoolkit.info/ajax-file-upload.html This tutorial covers all client side.
Om the server side
This tutorlal covers most of this issue:
http://www.ioncannon.net/programming/975/spring-3-file-upload-example/
Yopu can use jquery as well or any other JS framework.
But the mist important thing is the fact You need to remember that your tag on client side should have.
property. it means that your request contains muultipart data.
Uploadify 就是这么做的 > http://www.uploadify.com/
所有示例都是 php,但您应该能够将其转换到您的平台。
Uploadify does that trick > http://www.uploadify.com/
All samples are php but you should be able to convert it to your platform.