Fix upload file page error #97 #96

This commit is contained in:
Derry 2021-03-05 22:03:40 -08:00
parent 4483aab7d1
commit 12c4b0e91f
2 changed files with 8 additions and 4 deletions

View File

@ -31,11 +31,10 @@ local display_str="<strong>当前版本: </strong>"..version.."<br><strong>特
s = m:section(TypedSection, "feature", translate("特征库更新"), display_str )
fu = s:option(FileUpload, "")
fu.template = "cbi/other_upload"
fu.template = "cbi/oaf_upload"
s.anonymous = true
um = s:option(DummyValue, "rule_data")
um.template = "cbi/other_dvalue"
--um.value =rule_count .. " " .. translate("Records").. " "..version
s = m:section(TypedSection, "appfilter", translate("App Filter Rules"))
@ -172,7 +171,6 @@ http.setfilehandler(
if not meta then return end
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
if not fd then
--um.value = translate("Create upload file error.")
return
end
end
@ -182,7 +180,8 @@ http.setfilehandler(
if eof and fd then
fd:close()
local fd2 = io.open("/tmp/upload/"..meta.file)
local line=fd2:read("*l");
local line=fd2:read("*l");
fd2:close()
local ret=string.match(line, "#version")
if ret ~= nil then
local cmd="cp /tmp/upload/"..meta.file.." /etc/appfilter/feature.cfg";

View File

@ -0,0 +1,5 @@
<%+cbi/valueheader%>
<label class="cbi-value" style="display:inline-block; width: 130px" for="ulfile"><%:选择本地特征库文件:%></label>
<input class="cbi-input-file" style="width: 500px" type="file" id="ulfile" name="ulfile" />
<input type="submit" class="cbi-button cbi-input-apply" name="upload" value="<%:Upload%>" />
<%+cbi/valuefooter%>