开发者

How ajax file uploads work?

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 ?

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.

But, when we can not read the file from file s开发者_如何学JAVAystem, 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.


They all have some sort of back end component that runs on asp/.net or .php (there are others, of course)

There is no way to implement an uploader on your site without something on the back end to save the files.


They use flash. See: http://www.uploadify.com/

Some, now use HTML5 features.


Not necessary that it will use flash . I have custom uploader where I am showing progress in a div with filling it by color based on process done . I have a uploadtracker.js which returns progress done and based on that I saw that div process based on its return value.

Check these samples .

http://malsup.com/jquery/form/#file-upload

Here are some other in case any of them helps .

http://www.tutorialchip.com/jquery/9-powerful-jquery-file-upload-plugins/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜