How to make beautiful and easy file upload in javascript?

All I want is:

  • choose File
  • small progress bar (if it's not easy)
  • client side failure / success confirmation
  • trigger action on the server side.
  • all without page reloading

In addition, the simpler the better.

A fragment will be welcome.

+3
source share
4 answers

There are many scripts and manuals. Check for example http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

+1
source

-, , , , <input type='file'/>, .

<iframe/>, XMLHttpRequest , , , , script, , , , , - , . , - , . , ...

, , , .

, <input type='file'/> <input type='hidden'/>, . , , save, .

, , save.

+1

XMLHttpRequest ( Firefox Safari/Chrome ), - <iframe>.

If you want to download a real XHR file, I wrote an extended article on how to do this in Firefox 3. This is the low level that you really need to create an actual HTTP request from JavaScript strings.

+1
source

Maybe GearsUploader will match.

0
source

Source: https://habr.com/ru/post/1720344/


All Articles