mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-11-20 02:18:20 +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
|
if r then
|
||||||
result(r)
|
result(r)
|
||||||
else
|
else
|
||||||
|
self:error(m)
|
||||||
fail(m)
|
fail(m)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -141,13 +141,23 @@ vfs.write = function(path,data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
vfs.upload = function(path)
|
vfs.upload = function(path)
|
||||||
|
if(not path) then
|
||||||
|
return false, "Unknown upload destination, abort!"
|
||||||
|
end
|
||||||
local r,m = vfs.checkperm(path,"write")
|
local r,m = vfs.checkperm(path,"write")
|
||||||
if(r) then
|
if(r) then
|
||||||
local uid = ulib.uid(SESSION.user)
|
local uid = ulib.uid(SESSION.user)
|
||||||
local file = m.."/"..REQUEST["upload.file"]
|
local index = 0
|
||||||
ulib.move(REQUEST["upload.tmp"], file)
|
while(REQUEST["upload-"..index..".tmp"] ~= nil) do
|
||||||
ulib.chown(file, uid.id, uid.gid)
|
local file = m.."/"..REQUEST["upload-"..index..".file"]
|
||||||
return true, nil
|
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
|
else
|
||||||
return r,m
|
return r,m
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user