luci-base: Make default for FileUpload 'safe'
[project/luci.git] / modules / luci-base / luasrc / view / cbi / upload.htm
1 <%
2         local t = require("luci.tools.webadmin")
3         local v = self:cfgvalue(section)
4         local s = v and nixio.fs.stat(v)
5 -%>
6 <%+cbi/valueheader%>
7         <% if s then %>
8                 <%:Uploaded File%> (<%=t.byte_format(s.size)%>)
9                 <% if self.unsafeupload then %>
10                     <input type="hidden"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
11                     <input class="cbi-button cbi-input-image" type="image" value="<%:Replace entry%>" name="cbi.rlf.<%=section .. "." .. self.option%>" alt="<%:Replace entry%>" title="<%:Replace entry%>" src="<%=resource%>/cbi/reload.gif" />
12                 <% end %>
13         <% end %>
14
15         <% if not self.unsafeupload then %>
16                 <input type="hidden"<%= attr("value", v) .. attr("name", "cbi.rlf." .. section .. "." .. self.option) .. attr("id", "cbi.rlf." .. section .. "." .. self.option) %> />
17         <% end %>
18                 
19         <% if (not s) or (s and not self.unsafeupload) then %>
20                 <input class="cbi-input-file" type="file"<%= attr("name", cbid) .. attr("id", cbid) %> />
21         <% end %>
22         <input type="text" class="cbi-input-text" onchange="cbi_d_update(this.id)"<%=
23                 attr("name", cbid .. ".textbox") .. attr("id", cbid .. ".textbox") .. attr("value", luci.cbi.AbstractValue.cfgvalue(self, section) or self.default) .. ifattr(self.size, "size") .. ifattr(self.placeholder, "placeholder") .. ifattr(self.readonly, "readonly") .. ifattr(self.maxlength, "maxlength") %> />
24 <%+cbi/valuefooter%>