Mercurial Hosting > linkmystyle
comparison src/uploadcare/uploader2.html @ 0:8f4df159f06b
start public repo
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Fri, 11 Jul 2025 20:57:49 -0600 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:8f4df159f06b |
|---|---|
| 1 <!doctype html> | |
| 2 <html lang="en"> | |
| 3 <head> | |
| 4 <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| 5 <style> | |
| 6 </style> | |
| 7 <script src="https://ucarecdn.com/libs/widget/3.x/uploadcare.full.min.js"></script> | |
| 8 <script> | |
| 9 'use strict'; | |
| 10 var UPLOADCARE_PUBLIC_KEY = '718cc25ec1508ca5801d'; | |
| 11 var UPLOADCARE_TABS = 'file camera url facebook gdrive gphotos instagram'; | |
| 12 var UPLOADCARE_DO_NOT_STORE = true; | |
| 13 var UPLOADCARE_IMAGES_ONLY = true; | |
| 14 | |
| 15 let upload_result = null; /* For debug. */ | |
| 16 | |
| 17 function upload() { | |
| 18 // openDialog() apparently returns a promise, that, when done, returns another promise | |
| 19 // that, when done, returns object with file information. At least in case of success. | |
| 20 uploadcare.openDialog().done( | |
| 21 function( promise2 ) { | |
| 22 promise2.done(on_uploaded); | |
| 23 } | |
| 24 ) | |
| 25 } | |
| 26 | |
| 27 function on_uploaded( file ) { | |
| 28 upload_result = file; | |
| 29 if( file && file.cdnUrl ) { | |
| 30 let result = document.getElementById("result"); | |
| 31 result.src = file.cdnUrl; | |
| 32 } | |
| 33 } | |
| 34 </script> | |
| 35 </head> | |
| 36 <body> | |
| 37 <p>top</p> | |
| 38 <p> | |
| 39 <button onclick="upload()">Upload</button></br> | |
| 40 <img id="result"></img> | |
| 41 </p> | |
| 42 <p><a></a></p> | |
| 43 <p>bottom</p> | |
| 44 </body> | |
| 45 </html> |
