liquid_feedback_frontend
view app/main/draft/show_file_upload.lua @ 1495:17e7082c377a
Added image attachments for initiatives
author | bsw |
---|---|
date | Mon Feb 10 21:10:49 2020 +0100 (2020-02-10) |
parents | |
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)