annotate app/main/draft/show_file_upload.lua @ 1859:02c34183b6df
Fixed wrong filename in INSTALL file
 | author | bsw | 
 | date | Tue Nov 28 18:54:51 2023 +0100 (23 months ago) | 
 | parents | 17e7082c377a | 
 | children |  | 
 
 | rev | line source | 
| bsw@1495 | 1 local file_upload_session = param.get("file_upload_session") | 
| bsw@1495 | 2 file_upload_session = string.gsub(file_upload_session, "[^A-Za-z0-9]", "") | 
| bsw@1495 | 3 | 
| bsw@1495 | 4 local file_id = param.get("file_id") | 
| bsw@1495 | 5 file_id = string.gsub(file_id, "[^A-Za-z0-9]", "") | 
| bsw@1495 | 6 | 
| bsw@1495 | 7 local filename = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "file_upload-" .. file_upload_session .. "-" .. file_id .. ".jpg") | 
| bsw@1495 | 8 | 
| bsw@1495 | 9 if param.get("preview", atom.boolean) then | 
| bsw@1495 | 10   filename = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "file_upload-" .. file_upload_session .. "-" .. file_id .. ".preview.jpg") | 
| bsw@1495 | 11 end | 
| bsw@1495 | 12 | 
| bsw@1495 | 13 local data | 
| bsw@1495 | 14 | 
| bsw@1495 | 15 local fh = io.open(filename, "r") | 
| bsw@1495 | 16 if fh then | 
| bsw@1495 | 17   data = fh:read("*a") | 
| bsw@1495 | 18 end | 
| bsw@1495 | 19 | 
| bsw@1495 | 20 | 
| bsw@1495 | 21 slot.set_layout(nil, content_type) | 
| bsw@1495 | 22 slot.put_into("data", data) |