mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-25 17:08:22 +01:00
allow single multiple upload file
This commit is contained in:
parent
175f952f23
commit
bb88057ec1
BIN
dist/antd_web_apps.tar.gz
vendored
BIN
dist/antd_web_apps.tar.gz
vendored
Binary file not shown.
@ -191,6 +191,7 @@ function VFSController:upload(...)
|
||||
if r then
|
||||
result(r)
|
||||
else
|
||||
self:error(m)
|
||||
fail(m)
|
||||
end
|
||||
else
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user