liquid_feedback_frontend
view app/main/draft/show_file_upload.lua @ 1700:f7c42bcf1490
Allow showing other units in single unit mode
author | bsw |
---|---|
date | Thu Sep 23 18:21:11 2021 +0200 (2021-09-23) |
parents | 17e7082c377a |
children |
line source
1 local file_upload_session = param.get("file_upload_session")
2 file_upload_session = string.gsub(file_upload_session, "[^A-Za-z0-9]", "")
4 local file_id = param.get("file_id")
5 file_id = string.gsub(file_id, "[^A-Za-z0-9]", "")
7 local filename = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "file_upload-" .. file_upload_session .. "-" .. file_id .. ".jpg")
9 if param.get("preview", atom.boolean) then
10 filename = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "file_upload-" .. file_upload_session .. "-" .. file_id .. ".preview.jpg")
11 end
13 local data
15 local fh = io.open(filename, "r")
16 if fh then
17 data = fh:read("*a")
18 end
21 slot.set_layout(nil, content_type)
22 slot.put_into("data", data)