diff --git a/dist/antd_web_apps.tar.gz b/dist/antd_web_apps.tar.gz index 35767d4..ab5dee5 100644 Binary files a/dist/antd_web_apps.tar.gz and b/dist/antd_web_apps.tar.gz differ diff --git a/os/controllers/VFSController.lua b/os/controllers/VFSController.lua index 01872c2..5e41456 100644 --- a/os/controllers/VFSController.lua +++ b/os/controllers/VFSController.lua @@ -191,6 +191,7 @@ function VFSController:upload(...) if r then result(r) else + self:error(m) fail(m) end else diff --git a/os/libs/vfs.lua b/os/libs/vfs.lua index 71d9505..a5b74f0 100644 --- a/os/libs/vfs.lua +++ b/os/libs/vfs.lua @@ -141,13 +141,23 @@ vfs.write = function(path,data) end vfs.upload = function(path) + if(not path) then + return false, "Unknown upload destination, abort!" + end local r,m = vfs.checkperm(path,"write") if(r) then local uid = ulib.uid(SESSION.user) - local file = m.."/"..REQUEST["upload.file"] - ulib.move(REQUEST["upload.tmp"], file) - ulib.chown(file, uid.id, uid.gid) - return true, nil + local index = 0 + while(REQUEST["upload-"..index..".tmp"] ~= nil) do + local file = m.."/"..REQUEST["upload-"..index..".file"] + ulib.move(REQUEST["upload-"..index..".tmp"], file) + ulib.chown(file, uid.id, uid.gid) + index = index + 1 + end + if(index == 0) then + return false, "No file is uploaded" + end + return true, index else return r,m end