如何AJAX文件上传工作? [英] How ajax file uploads work?

查看:96
本文介绍了如何AJAX文件上传工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道,JQuery的(或JavaScript)不能访问本地文件系统。那么,如何jQuery的各种AJAX文件上传插件实际工作,甚至显示进度条?

We know that, JQuery ( or javascript ) can not access local file system. So how does the various ajax file upload plugins of jquery actually work and even show the progress bar ?

我曾把使用Java小程序的文件上传,我可以做到这一点,因为在某种程度上,我能够读取使用小程序中的本地文件系统中的文件。因为我能读它,我把它一个100行的时间为100线多个部分,每个部分的发送成功使用 ajax.post ,操作进度条相应。

I once made an File Uploader using Java Applet and I could do it because somehow I was able to read the file from the local file system using applet. Because I was able to read it, I sent it a 100 lines at a time using ajax.post in multiple parts of 100 lines and as each of the part is successfully sent, manipulated the progress bar accordingly.

但是,当我们不能读取文件系统中的文件,然后怎么做的jQuery的AJAX插件显示进度条和上传文件异步?

But, when we can not read the file from file system, then how do the ajax plugins of jquery show the progress bar and upload the files asynchronously ?

推荐答案

通常情况下,有在服务器端的处理程序接受后,又接连处理报告任何上传的进度。

Typically, there is a handler on the server side accepting the post, and then another handler to report progress of any upload.

如果你举个例子框架来使用,我们可以给出一个更明确的答案。

If you give an example framework to use, we can give a more specific answer.

这篇关于如何AJAX文件上传工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆