Mercurial Hosting > freedit
comparison src/test/upload.js.luan @ 33:4fdc4ec0050b
upload with uploadcare
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Mon, 01 Aug 2022 22:50:16 -0600 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 32:72a1b77b4548 | 33:4fdc4ec0050b |
|---|---|
| 1 local Luan = require "luan:Luan.luan" | |
| 2 local error = Luan.error | |
| 3 local stringify = Luan.stringify or error() | |
| 4 local Io = require "luan:Io.luan" | |
| 5 local Http = require "luan:http/Http.luan" | |
| 6 local Shared = require "site:/lib/Shared.luan" | |
| 7 local get_url_from_file = Shared.get_url_from_file or error() | |
| 8 local Logging = require "luan:logging/Logging.luan" | |
| 9 local logger = Logging.logger "test/upload.js" | |
| 10 | |
| 11 | |
| 12 return function() | |
| 13 local file = Http.request.parameters.file or error() | |
| 14 --logger.info(stringify(file)); | |
| 15 local url = get_url_from_file(file) | |
| 16 --logger.info("url = "..url) | |
| 17 Io.stdout = Http.response.text_writer() | |
| 18 %> | |
| 19 let url = '<%=url%>'; | |
| 20 let a = document.querySelector('a'); | |
| 21 a.textContent = url; | |
| 22 a.setAttribute('href',url); | |
| 23 <% | |
| 24 end |
