Is it possible to use Ajax to do file upload?

No, it isn’t possible to do this with javascript.

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.

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.

As pointed out in the comments, you can also use something like the very popular SWFUpload to accomplish the desired effect with Flash.

Leave a Comment