[PATCH] Naive fix for bug #208
For SimpleSection, use the section name (always "1") instead of the section type in the CBI-like string used to identify the upload. This allows upload fields to be placed in SimpleSections. The fix changes a minimal number of lines, but does introduce some unnecessary confusion, it may or may not be better than a more thorough/invasive fix. Set the enctype for the form element in the simpleform view to be multipart/form-data because the default application/x-www-form-urlencoded does not support input files. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
This commit is contained in:
parent
8358175f25
commit
3553d308f6
2 changed files with 4 additions and 4 deletions
|
@ -102,7 +102,7 @@ function load(cbimap, ...)
|
||||||
for _, field in ipairs(map.upload_fields) do
|
for _, field in ipairs(map.upload_fields) do
|
||||||
uploads[
|
uploads[
|
||||||
field.config .. '.' ..
|
field.config .. '.' ..
|
||||||
field.section.sectiontype .. '.' ..
|
(field.section.sectiontype or '1') .. '.' ..
|
||||||
field.option
|
field.option
|
||||||
] = true
|
] = true
|
||||||
end
|
end
|
||||||
|
@ -124,8 +124,8 @@ function load(cbimap, ...)
|
||||||
)()
|
)()
|
||||||
|
|
||||||
if c and s and o then
|
if c and s and o then
|
||||||
local t = uci:get( c, s )
|
local t = uci:get( c, s ) or s
|
||||||
if t and uploads[c.."."..t.."."..o] then
|
if uploads[c.."."..t.."."..o] then
|
||||||
local path = upldir .. field.name
|
local path = upldir .. field.name
|
||||||
fd = io.open(path, "w")
|
fd = io.open(path, "w")
|
||||||
if fd then
|
if fd then
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<% if not self.embedded then %>
|
<% if not self.embedded then %>
|
||||||
<form method="post" action="<%=REQUEST_URI%>">
|
<form method="post" enctype="multipart/form-data" action="<%=REQUEST_URI%>">
|
||||||
<div>
|
<div>
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
<input type="hidden" name="cbi.submit" value="1" />
|
<input type="hidden" name="cbi.submit" value="1" />
|
||||||
|
|
Loading…
Reference in a new issue