跳至主要內容

上傳裝置檔案到中控 (LCC.web_file.upload_file)

聲明​

ok, err = LCC.web_file.upload_file(local_path, remote_path, timeout?)

參數​

  • local_path
    字串型,裝置端來源檔案路徑
  • remote_path
    字串型,中控端目標路徑
  • timeout
    數值型,可選;請求逾時時間(秒),預設 60

回傳值​

  • ok
    布林值,上傳成功傳回 true,失敗傳回 false
  • err
    字串型或 nil,失敗時的錯誤描述

說明​

上傳裝置端本機檔案到中控,會覆蓋同名檔案。
父目錄不存在時會自動建立。

範例​

local ok, err = LCC.web_file.upload_file(XXT_SCRIPTS_PATH.."/result.txt", "/result.txt")
if not ok then
error(err)
end