1

How do I start with creating a file upload mechanism that works via Ajax? I've written file upload scripts before but they involved no JavaScript, just submitting a form with a modified encoding type attribute. I need the file upload to have the following features:

  1. Progress bar
  2. Error checking (for network connection drops, bad data, etc)
  3. Absolutely no "manual" form submission, Ajax takes care of it all.

And finally you know those upload buttons that allow you to select multiple files at once compared to the that only lets you select one file at a time? How can I implement those as well?

I'm using PHP as my backend btw.

2 Answers 2

3

You can find answers for your questions by looking at already done ajax file uploaders. There are many different plugins for jquery for example. One of the good place to start is to look at elfinder. Its based on jQuery & jQuery UI frontend and has Python and Php connectors for backend. Here are another usefull links:

The main thing, that you should understand, that its not possible to upload files using xhr-requests. And for today, the only way to upload files, is to use hidden iframes, and some javascript magic to carry out the work.

Sign up to request clarification or add additional context in comments.

1 Comment

That is true about the hidden iframes, I've used tons of the file uploaders trying to find one that I find easy to use, and all of them use either a hidden iframe or flash to post the upload to.
2

I've been searching for good file upload scrips for a long time. I've been using the YUI file uploader most recently, but the following should work well with PHP. For some reason I had a heck of a time learning how to get the YUI to work, plus it uses Flash to do the actual upload.

http://aquantum-demo.appspot.com/file-upload

with set up information for PHP on this page:

https://github.com/blueimp/jQuery-File-Upload/wiki/Setup

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.