liquid_feedback_frontend
view app/main/draft/show_file_upload.lua @ 1812:fc3f15316a68
Better error handling also for creating new accounts
| author | bsw | 
|---|---|
| date | Thu Dec 02 13:33:05 2021 +0100 (2021-12-02) | 
| 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)
