index.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Transloadit Example</title>
  7. </head>
  8. <body>
  9. <style>
  10. html {
  11. background: #f1f1f1;
  12. }
  13. main {
  14. padding: 20px;
  15. font: 12pt sans-serif;
  16. background: white;
  17. width: 800px;
  18. margin: auto;
  19. }
  20. hr {
  21. border: 0;
  22. background-color: #111e33;
  23. height: 1px;
  24. }
  25. .hidden { display: none; }
  26. .error { color: red; }
  27. #logo { height: 1em; vertical-align: middle; }
  28. </style>
  29. <main>
  30. <h1>Uppy Transloadit <img src="https://transloadit.edgly.net/assets/images/logo-small.svg" alt="Transloadit" id="logo"> playground</h1>
  31. <p>
  32. This page contains small examples for different ways you can use Uppy with Transloadit. Please see the <a href="https://github.com/transloadit/uppy/tree/main/examples/transloadit">Github repository</a> for the source code.
  33. </p>
  34. <hr>
  35. <h2>Form</h2>
  36. <p>
  37. The form API allows you to easily send files through Transloadit’s encoding backend. When the user submits the form, any files are uploaded to Transloadit. The form data is then sent to your own backend, with additional data about the Transloadit Assemblies that were started.
  38. </p>
  39. <form id="test-form" method="post" action="http://localhost:9967/test">
  40. <p><strong>leave a message</strong></p>
  41. <p>
  42. <label>name:
  43. <input type="text" name="name">
  44. </label>
  45. </p>
  46. <p>
  47. <label>message: <br>
  48. <textarea name="message"></textarea>
  49. </label>
  50. </p>
  51. <p>
  52. <label>
  53. attachments:
  54. <!-- <input type="file" name="files" multiple> -->
  55. <strong id="uppy-form-selected-files"></strong>
  56. <button type="button" id="uppy-select-files">Select Files</button>
  57. </label>
  58. <div class="progress"></div>
  59. </p>
  60. <p>
  61. <button type="submit">
  62. Upload
  63. </button>
  64. </p>
  65. <span class="error"></span>
  66. </form>
  67. <hr>
  68. <h2>Form with inline Dashboard</h2>
  69. <p>
  70. You can also use the Dashboard UI inside a plain old HTML form.
  71. </p>
  72. <form id="dashboard-form" method="post" action="http://localhost:9967/test">
  73. <p><strong>leave a message</strong></p>
  74. <p>
  75. <label>name:
  76. <input type="text" name="name">
  77. </label>
  78. </p>
  79. <p>
  80. <label>message: <br>
  81. <textarea name="message"></textarea>
  82. </label>
  83. </p>
  84. <p>
  85. <label>
  86. attachments:
  87. <span class="dashboard"></span>
  88. </label>
  89. </p>
  90. <p>
  91. <button type="submit">
  92. Upload
  93. </button>
  94. </p>
  95. <span class="error"></span>
  96. </form>
  97. <hr>
  98. <h2>Inline Dashboard</h2>
  99. <p>
  100. The <code>robodog.dashboard</code> API allows you to embed a Dashboard at any location. Users can continuously upload files through this UI, so please make sure this fits your use case!
  101. </p>
  102. <div id="dashboard"></div>
  103. <hr>
  104. <h2>Dashboard Modal</h2>
  105. <p>
  106. This API is a one-shot upload UI using a modal overlay. Call the function and receive a listen to an event with upload results ✌️
  107. </p>
  108. <button onclick="openModal()">Open</button>
  109. <h2>uppy.upload()</h2>
  110. <p>
  111. An &lt;input type=file&gt; backed by <code>uppy.upload()</code>:
  112. </p>
  113. <p>
  114. <input type="file" multiple onchange="doUpload(event)">
  115. </p>
  116. <div id="upload-progress"></div>
  117. <div id="upload-result-image"></div>
  118. <code>
  119. <pre id="upload-result" style="font-size: 12px; max-width: 100%; max-height: 300px; white-space: pre-wrap; overflow: auto;"></pre>
  120. <pre id="upload-error" class="error"></pre>
  121. </code>
  122. </main>
  123. <script src="./main.js" type="module"></script>
  124. </body>
  125. </html>