Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <html>
  2. <head></head>
  3. <body>
  4. <input type="file"/>
  5. <button>upload</button>
  6. <p></p>
  7.  
  8. <script>
  9. var input = document.querySelector('input'),
  10. button = document.querySelector('button'),
  11. p = document.querySelector('p');
  12.  
  13. input.addEventListener('change', function(event) {
  14. var files = event.target.files;
  15. uploader.addFiles(files);
  16.  
  17. p.innerHTML = '';
  18. for (var i = 0, file; file = uploader.files[i]; i++) {
  19. p.innerHTML += 'file: <strong>' + file.name + '</strong> size: <strong>' + file.humanSize + '</strong>';
  20. }
  21. });
  22.  
  23. button.addEventListener('click', function () {
  24. uploader.startUpload({
  25. url: '/url/to/upload/handler',
  26. concurrency: 2,
  27. onProgress: function(file) {},
  28. onCompleted: function(file, response) {}
  29. });
  30. });
  31. </script>
  32. </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement