app.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!-- Load Uppy CSS bundle. It is advisable to install Uppy
  2. from npm/yarn instead, and pick and choose the plugins/styles you need.
  3. But for experimenting, you can use Transloadit’s CDN, Edgly: -->
  4. <link rel="stylesheet" href="https://transloadit.edgly.net/releases/uppy/v1.15.0/uppy.min.css">
  5. <div class="UppyDragDrop"></div>
  6. <div class="for-ProgressBar"></div>
  7. <div class="uploaded-files">
  8. <h5>Uploaded files:</h5>
  9. <ol></ol>
  10. </div>
  11. <!-- Load Uppy JS bundle. -->
  12. <script src="https://transloadit.edgly.net/releases/uppy/v1.15.0/uppy.min.js"></script>
  13. <script src="https://transloadit.edgly.net/releases/uppy/locales/v1.14.0/ru_RU.min.js"></script>
  14. <script>
  15. var uppy = Uppy.Core({
  16. debug: true,
  17. autoProceed: true,
  18. locale: Uppy.locales.ru_RU
  19. });
  20. uppy.use(Uppy.DragDrop, {
  21. target: '.UppyDragDrop',
  22. // We are using the ru_RU locale pack (set above in Uppy.Core options),
  23. // but you can also override specific strings like so:
  24. locale: {
  25. strings: {
  26. browse: 'выберите ;-)'
  27. }
  28. }
  29. });
  30. uppy.use(Uppy.ProgressBar, {
  31. target: '.for-ProgressBar',
  32. hideAfterFinish: false
  33. });
  34. uppy.use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' });
  35. uppy.on('upload-success', function (file, response) {
  36. var url = response.uploadURL
  37. var fileName = file.name
  38. document.querySelector('.uploaded-files ol').innerHTML +=
  39. '<li><a href="' + url + '" target="_blank">' + fileName + '</a></li>'
  40. });
  41. console.log('--> Uppy pre-built version with Tus, DragDrop & Russian language pack has loaded');
  42. </script>