函数:ts.ftp.upload 上传文件

函数名称:上传文件

函数功能:上传本地文件到服务器

函数方法

status = ts.ftp.upload(localfilepath,severfilepath,kind);

参数 类型 必填 说明
localfilepath string 本地文件路径
severfilepath string FTP 文件路径
kind number 不写默认值 1 表示文本类型,0 表示非文本类型
返回值 类型 说明
status boolean true - 上传成功,false - 上传失败

函数用例

--脚本仅供参考不可直接使用
local ts = require("ts")--使用官方库前一定要在开头插入这一句
status = ts.ftp.connect("111.111.11.151","username","password") 
if status then
    dialog("连接成功", 0)
else
    dialog("连接失败", 0)
end
upStatus = ts.ftp.upload(userPath().."/lua/main.txt","/haha/main.txt") 
--上传本地 lua 文件夹下的 main.lua 文件到服务器的 haha 文件夹里
if upStatus then
    toast("上传完成", 1)
else
    toast("上传失败", 1)
end
ts.ftp.close()  --操作完成后,断开 FTP 服务器连接
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""