index.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 {
  26. display: none;
  27. }
  28. .error {
  29. color: red;
  30. }
  31. #logo {
  32. height: 1em;
  33. vertical-align: middle;
  34. }
  35. </style>
  36. <main>
  37. <h1>
  38. Uppy Transloadit
  39. <img
  40. src="https://my-app.tlcdn.com/resize-img/canoe.jpg?w=300&h=300"
  41. alt="Transloadit"
  42. id="logo"
  43. />
  44. playground
  45. </h1>
  46. <p>
  47. This page contains small examples for different ways you can use Uppy
  48. with Transloadit. Please see the
  49. <a
  50. href="https://github.com/transloadit/uppy/tree/main/examples/transloadit"
  51. >Github repository</a
  52. >
  53. for the source code.
  54. </p>
  55. <hr />
  56. <h2>Form</h2>
  57. <p>
  58. The form API allows you to easily send files through Transloadit’s
  59. encoding backend. When the user submits the form, any files are uploaded
  60. to Transloadit. The form data is then sent to your own backend, with
  61. additional data about the Transloadit Assemblies that were started.
  62. </p>
  63. <form id="test-form" method="post" action="http://localhost:9967/test">
  64. <p><strong>leave a message</strong></p>
  65. <p>
  66. <label
  67. >name:
  68. <input type="text" name="name" />
  69. </label>
  70. </p>
  71. <p>
  72. <label
  73. >message: <br />
  74. <textarea name="message"></textarea>
  75. </label>
  76. </p>
  77. <p>
  78. <label>
  79. attachments:
  80. <!-- <input type="file" name="files" multiple> -->
  81. <strong id="uppy-form-selected-files"></strong>
  82. <button type="button" id="uppy-select-files">Select Files</button>
  83. </label>
  84. <span class="progress"></span>
  85. </p>
  86. <p>
  87. <button type="submit">Upload</button>
  88. </p>
  89. <span class="error"></span>
  90. </form>
  91. <hr />
  92. <h2>Form with inline Dashboard</h2>
  93. <p>You can also use the Dashboard UI inside a plain old HTML form.</p>
  94. <form
  95. id="dashboard-form"
  96. method="post"
  97. action="http://localhost:9967/test"
  98. >
  99. <p><strong>leave a message</strong></p>
  100. <p>
  101. <label
  102. >name:
  103. <input type="text" name="name" />
  104. </label>
  105. </p>
  106. <p>
  107. <label
  108. >message: <br />
  109. <textarea name="message"></textarea>
  110. </label>
  111. </p>
  112. <p>
  113. <label>
  114. attachments:
  115. <span class="dashboard"></span>
  116. </label>
  117. </p>
  118. <p>
  119. <button type="submit">Upload</button>
  120. </p>
  121. <span class="error"></span>
  122. </form>
  123. <hr />
  124. <h2>Inline Dashboard</h2>
  125. <p>
  126. The <code>robodog.dashboard</code> API allows you to embed a Dashboard
  127. at any location. Users can continuously upload files through this UI, so
  128. please make sure this fits your use case!
  129. </p>
  130. <div id="dashboard"></div>
  131. <hr />
  132. <h2>Dashboard Modal</h2>
  133. <p>
  134. This API is a one-shot upload UI using a modal overlay. Call the
  135. function and receive a listen to an event with upload results ✌️
  136. </p>
  137. <button onclick="openModal()">Open</button>
  138. <h2>uppy.upload()</h2>
  139. <p>An &lt;input type=file&gt; backed by <code>uppy.upload()</code>:</p>
  140. <p>
  141. <input type="file" multiple onchange="doUpload(event)" />
  142. </p>
  143. <div id="upload-progress"></div>
  144. <div id="upload-result-image"></div>
  145. <code>
  146. <pre
  147. id="upload-result"
  148. style="
  149. font-size: 12px;
  150. max-width: 100%;
  151. max-height: 300px;
  152. white-space: pre-wrap;
  153. overflow: auto;
  154. "
  155. ></pre>
  156. <pre id="upload-error" class="error"></pre>
  157. </code>
  158. </main>
  159. <script src="./main.js" type="module"></script>
  160. </body>
  161. </html>