简体   繁体   中英

Is it possible to upload a file with AJAX and no iframe or Flash?

Every time I have looked into AJAXy file uploading, an iframe has always been used underneath, somewhere.

Is it possible to upload a file using AJAX and no iframe or Flash? How about in the more recent versions of Firefox and Chrome?

I'm debating with my co-workers, arguing that you cannot perform an AJAXy upload with pure Javascript, since you cannot read the file contents from the user's harddrive in order to pass in the file contents via the AJAX call to the server side script.

You can use famous jQuery Uploadify plugin .

Uploadify is a jQuery plugin that integrates a fully-customizable multiple file upload utility on your website. It uses a mixture of Javascript, ActionScript, and any server-side language to dynamically create an instance over any DOM element on a page.

我也使用Valums File Uploader

You can use the file API on firefox (3.6 and above) and I think the latest webkit supports it as well (not sure) though.

I did a Mootools plugin that works on FF:

http://mootools.standupweb.net/dragndrop.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM