webmcp

view framework/env/ui/field/file.lua @ 412:7d43be9afa56

Improved memory cleanup in case of out-of-memory errors (PQnotifies and PQunescapeBytea)
author jbe
date Fri Jan 08 03:10:33 2016 +0100 (2016-01-08)
parents 36ebcae1cde3
children
line source
1 --[[--
2 ui.field.file{
3 ... -- generic ui.field.* arguments, as described for ui.autofield{...}
4 }
6 This function inserts a field for uploading a file in the active slot. For read-only forms this function does nothing. For description of the generic field helper arguments, see help for ui.autofield{...}.
8 --]]--
10 function ui.field.file(args)
11 ui.form_element(args, nil, function(args)
12 if args.readonly then
13 -- nothing
14 else
15 if not slot.get_state_table().form_file_upload then
16 error('Parameter "file_upload" of ui.form{...} must be set to true to allow file uploads.')
17 end
18 local attr = table.new(args.attr)
19 attr.type = "file"
20 attr.name = args.html_name
21 ui.tag{ tag = "input", attr = attr }
22 end
23 end)
24 end

Impressum / About Us