我不想使用 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 进行文件上传?
发布评论