是否可以使用 Ajax 进行文件上传?

编程入门 行业动态 更新时间:2024-10-26 00:29:35
本文介绍了是否可以使用 Ajax 进行文件上传?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不想使用 jQuery,但我想使用 Ajax 进行文件上传.这可能吗?

I don't want to use jQuery, but I'd like to use Ajax to do file uploading. Is that possible?

如果是这样,我在哪里可以找到有关它的信息/教程?

If so, where can I find information/tutorial on it?

推荐答案

不,使用 javascript 无法做到这一点.

No, it isn't possible to do this with javascript.

然而,为了给人一种AJAX"的感觉,您可以将表单提交到隐藏的 iframe 并将脚本结果输出到它,然后从那里进行处理.谷歌 ajax iframe 上传 并从

In order to give the 'AJAX' feel, however, you can submit a form to a hidden iframe and output the script results to it, then process from there. Google ajax iframe upload and get started from there.

如果您使用 jQuery,还有 Form plugin如果您的表单中有任何文件字段,它将自动为您创建此 iframe.我没有用它来做这件事,但我听说过很好的事情.

If you are using jQuery, there is also the Form plugin which will automatically create this iframe for you if your form has any file fields in it. I haven't used it to do this, but I've heard good things.

正如评论中所指出的,您还可以使用非常流行的SWFUpload 使用 Flash 实现所需的效果.

As pointed out in the comments, you can also use something like the very popular SWFUpload to accomplish the desired effect with Flash.

更多推荐

是否可以使用 Ajax 进行文件上传?

本文发布于:2023-11-30 14:51:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650400.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   文件上传   Ajax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!