是否有可能使用Ajax做文件上传? [英] Is it possible to use Ajax to do file upload?
问题描述
我不想使用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,也有 表格插件
它会自动创建这个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做文件上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!