函数:cloud_file_push 上传文件到云盘
方法名称:上传文件到云盘
方法功能:从本地上传一个文件到云盘
调用方法
ok,err = ts_enterprise_lib:cloud_file_push(local_file,cloud_file_name,timeout_seconds);
| 参数 | 类型 | 必填 | 说明 | 默认值 | 
|---|---|---|---|---|
| local_file | string | 是 | 本地文件路径,需包含完整文件名 | - | 
| cloud_file_name | string | 是 | 云盘文件路径,需包含完整文件名 | - | 
| timeout_seconds | number | 否 | 超时时间,单位秒。数据较大时,应适当延长 | 5 | 
| 返回值 | 类型 | 说明 | 
|---|---|---|
| ok | boolean | 操作结果,成功返回 true,失败返回 false | 
| err | string | 当 ok 等于 true,无返回值  当 ok 等于 false,返回错误原因  | 
函数用例
-- 此库为企业用户专用库,请勿在其他产品使用,此库已内置,无需下载
--如果提示没有 ts_enterprise_lib 库请重启旗舰版客户端服务再试
ts_enterprise_lib = require("ts_enterprise_lib")
assert(ts_enterprise_lib,"无法引入企业专用库")
local local_file = userPath().."/1.lua"      --本地文件名
local cloud_file_name = "push.lua"           --云文件名,包含目录的完整文件名
local timeout_seconds = 5;                   --超时秒数,数据较大时,适当延长
local ok,err = ts_enterprise_lib:cloud_file_push(local_file,cloud_file_name,timeout_seconds)
if ok then
    dialog("上传成功",5)
else
    dialog("上传失败,失败原因:"..err,5)
end
注意事项
- 错误返回 timeout 请在获取数据前增加代码 ts_enterprise_lib.timeout = 20 或者增加参数: timeout_seconds 的时间,如果仍返回 timeout 请修改为 20 以上的数字