"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[6871],{4431:(e,l,n)=>{n.r(l),n.d(l,{assets:()=>a,contentTitle:()=>s,default:()=>u,frontMatter:()=>t,metadata:()=>r,toc:()=>c});const r=JSON.parse('{"id":"XXTLanControl.lua/web-file/upload_file","title":"Upload Device File To Controller (LCC.web_file.upload_file)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/upload_file.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/upload_file","permalink":"/docs/en/XXTLanControl.lua/web-file/upload_file","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":130,"frontMatter":{"sidebar_position":130},"sidebar":"tutorialSidebar","previous":{"title":"Download Controller File To Device (LCC.web_file.download_file)","permalink":"/docs/en/XXTLanControl.lua/web-file/download_file"},"next":{"title":"Read File As Lines (LCC.web_file.get_lines)","permalink":"/docs/en/XXTLanControl.lua/web-file/get_lines"}}');var o=n(4848),i=n(8453);const t={sidebar_position:130},s="Upload Device File To Controller (LCC.web_file.upload_file)",a={},c=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const l={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l.header,{children:(0,o.jsx)(l.h1,{id:"upload-device-file-to-controller-lccweb_fileupload_file",children:"Upload Device File To Controller (LCC.web_file.upload_file)"})}),"\n",(0,o.jsx)(l.h2,{id:"signature",children:"Signature"}),"\n",(0,o.jsx)(l.pre,{children:(0,o.jsx)(l.code,{className:"language-lua",children:"ok, err = LCC.web_file.upload_file(local_path, remote_path, timeout?)\n"})}),"\n",(0,o.jsx)(l.h2,{id:"parameters",children:"Parameters"}),"\n",(0,o.jsxs)(l.ul,{children:["\n",(0,o.jsxs)(l.li,{children:["local_path",(0,o.jsx)(l.br,{}),"\n","String. Source path on the device."]}),"\n",(0,o.jsxs)(l.li,{children:["remote_path",(0,o.jsx)(l.br,{}),"\n","String. Destination path on the controller."]}),"\n",(0,o.jsxs)(l.li,{children:["timeout",(0,o.jsx)(l.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,o.jsx)(l.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,o.jsx)(l.h2,{id:"returns",children:"Returns"}),"\n",(0,o.jsxs)(l.ul,{children:["\n",(0,o.jsxs)(l.li,{children:["ok",(0,o.jsx)(l.br,{}),"\n","Boolean. ",(0,o.jsx)(l.code,{children:"true"})," on success, ",(0,o.jsx)(l.code,{children:"false"})," on failure."]}),"\n",(0,o.jsxs)(l.li,{children:["err",(0,o.jsx)(l.br,{}),"\n","String or ",(0,o.jsx)(l.code,{children:"nil"}),". Error description when the upload fails."]}),"\n"]}),"\n",(0,o.jsx)(l.h2,{id:"notes",children:"Notes"}),"\n",(0,o.jsxs)(l.blockquote,{children:["\n",(0,o.jsxs)(l.p,{children:["Uploads a local device file to the controller, overwriting any existing file.",(0,o.jsx)(l.br,{}),"\n","Missing parent directories are created automatically."]}),"\n"]}),"\n",(0,o.jsx)(l.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(l.pre,{children:(0,o.jsx)(l.code,{className:"language-lua",children:'local ok, err = LCC.web_file.upload_file(XXT_SCRIPTS_PATH.."/result.txt", "/result.txt")\nif not ok then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:l}={...(0,i.R)(),...e.components};return l?(0,o.jsx)(l,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,l,n)=>{n.d(l,{R:()=>t,x:()=>s});var r=n(6540);const o={},i=r.createContext(o);function t(e){const l=r.useContext(i);return r.useMemo(function(){return"function"==typeof e?e(l):{...l,...e}},[l,e])}function s(e){let l;return l=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:t(e.components),r.createElement(i.Provider,{value:l},e.children)}}}]);