liquid_feedback_frontend

annotate app/main/index/document_file.lua @ 401:08ba83dd47c0

Add support for files only available to logged in members
author bsw
date Wed Mar 07 19:07:20 2012 +0100 (2012-03-07)
parents
children a42bc1f0ed45
rev   line source
bsw@401 1 if not config.document_dir then
bsw@401 2 error("feature not enabled")
bsw@401 3 end
bsw@401 4
bsw@401 5 local filename = param.get("filename")
bsw@401 6
bsw@401 7 local file = assert(io.open(encode.file_path(config.document_dir, filename)), "file not found")
bsw@401 8
bsw@401 9 print('Content-type: application/octet-stream')
bsw@401 10 print('Content-disposition: attachment; filename=' .. filename)
bsw@401 11 print('')
bsw@401 12
bsw@401 13 io.stdout:write(file:read("*a"))
bsw@401 14
bsw@401 15 exit()

Impressum / About Us