上传头像图片,无需页面上传
我想在我的项目中添加头像图片上传功能,我想知道是否存在任何 AJAX/jQuery 解决方案来上传图片而无需在上传后刷新页面(图片自动上传)。
I want to add an avatar image upload feature to my project, and I was wondering if there exists any AJAX/jQuery solution for uploading an image without needing to refresh the page after uploading (the image uploads automatically).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我已经在几个项目中使用了 http://www.uploadify.com/ 并且效果很好。
I have used http://www.uploadify.com/ in several projects and it works great.
貌似这个可以做,还没试过。
http://www.plupload.com/
Apparently this can do it, haven't tried it yet.
http://www.plupload.com/
您可以使用 iframe 作为目标,以避免整个页面重新加载:
You could use an iframe as target, to avoid full page reload:
尝试使用触发器更新面板不起作用!
不工作:
可以工作:
所以你必须将整个 FileUpload 标签放在一个单独的页面中,并在主页的 iframe 中调用它,当然将“上传”按钮保留在 iframe 中;因此,通过单击上传按钮,iframe 将单独刷新,而不会刷新整个页面。
(经过充分测试)
trying update panel with a trigger DOES NOT WORK !!
DOESNT NOT WORK:
DO WORK:
so you have to go with placing the whole FileUpload tag in a separate page, and call it in iframe in your main page, and of course keep the "Upload" button in the iframe; so by click on the upload button the iframe alone will refresh without refreshing the whole page.
(well tested)