"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[8752],{3060:(e,l,n)=>{n.r(l),n.d(l,{assets:()=>d,contentTitle:()=>s,default:()=>u,frontMatter:()=>t,metadata:()=>i,toc:()=>a});const i=JSON.parse('{"id":"XXTLanControl.lua/web-file/upload_file","title":"\u4e0a\u4f20\u8bbe\u5907\u6587\u4ef6\u5230\u4e2d\u63a7 (LCC.web_file.upload_file)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/web-file/upload_file.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/upload_file","permalink":"/docs/XXTLanControl.lua/web-file/upload_file","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":130,"frontMatter":{"sidebar_position":130},"sidebar":"tutorialSidebar","previous":{"title":"\u4e0b\u8f7d\u4e2d\u63a7\u6587\u4ef6\u5230\u8bbe\u5907 (LCC.web_file.download_file)","permalink":"/docs/XXTLanControl.lua/web-file/download_file"},"next":{"title":"\u8bfb\u53d6\u6587\u4ef6\u4e3a\u884c\u6570\u7ec4 (LCC.web_file.get_lines)","permalink":"/docs/XXTLanControl.lua/web-file/get_lines"}}');var r=n(4848),o=n(8453);const t={sidebar_position:130},s="\u4e0a\u4f20\u8bbe\u5907\u6587\u4ef6\u5230\u4e2d\u63a7 (LCC.web_file.upload_file)",d={},a=[{value:"\u58f0\u660e",id:"\u58f0\u660e",level:2},{value:"\u53c2\u6570",id:"\u53c2\u6570",level:2},{value:"\u8fd4\u56de\u503c",id:"\u8fd4\u56de\u503c",level:2},{value:"\u8bf4\u660e",id:"\u8bf4\u660e",level:2},{value:"\u793a\u4f8b",id:"\u793a\u4f8b",level:2}];function c(e){const l={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.header,{children:(0,r.jsx)(l.h1,{id:"\u4e0a\u4f20\u8bbe\u5907\u6587\u4ef6\u5230\u4e2d\u63a7-lccweb_fileupload_file",children:"\u4e0a\u4f20\u8bbe\u5907\u6587\u4ef6\u5230\u4e2d\u63a7 (LCC.web_file.upload_file)"})}),"\n",(0,r.jsx)(l.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,r.jsx)(l.pre,{children:(0,r.jsx)(l.code,{className:"language-lua",children:"ok, err = LCC.web_file.upload_file(local_path, remote_path, timeout?)\n"})}),"\n",(0,r.jsx)(l.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,r.jsxs)(l.ul,{children:["\n",(0,r.jsxs)(l.li,{children:["local_path",(0,r.jsx)(l.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u8bbe\u5907\u7aef\u6e90\u6587\u4ef6\u8def\u5f84"]}),"\n",(0,r.jsxs)(l.li,{children:["remote_path",(0,r.jsx)(l.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u4e2d\u63a7\u7aef\u76ee\u6807\u8def\u5f84"]}),"\n",(0,r.jsxs)(l.li,{children:["timeout",(0,r.jsx)(l.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,r.jsx)(l.code,{children:"60"})]}),"\n"]}),"\n",(0,r.jsx)(l.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,r.jsxs)(l.ul,{children:["\n",(0,r.jsxs)(l.li,{children:["ok",(0,r.jsx)(l.br,{}),"\n","\u5e03\u5c14\u578b\uff0c\u4e0a\u4f20\u6210\u529f\u8fd4\u56de ",(0,r.jsx)(l.code,{children:"true"}),"\uff0c\u5931\u8d25\u8fd4\u56de ",(0,r.jsx)(l.code,{children:"false"})]}),"\n",(0,r.jsxs)(l.li,{children:["err",(0,r.jsx)(l.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,r.jsx)(l.code,{children:"nil"}),"\uff0c\u5931\u8d25\u65f6\u7684\u9519\u8bef\u63cf\u8ff0"]}),"\n"]}),"\n",(0,r.jsx)(l.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,r.jsxs)(l.blockquote,{children:["\n",(0,r.jsxs)(l.p,{children:["\u4e0a\u4f20\u8bbe\u5907\u7aef\u672c\u5730\u6587\u4ef6\u5230\u4e2d\u63a7\uff0c\u4f1a\u8986\u76d6\u540c\u540d\u6587\u4ef6\u3002",(0,r.jsx)(l.br,{}),"\n","\u7236\u76ee\u5f55\u4e0d\u5b58\u5728\u65f6\u4f1a\u81ea\u52a8\u521b\u5efa\u3002"]}),"\n"]}),"\n",(0,r.jsx)(l.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,r.jsx)(l.pre,{children:(0,r.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,o.R)(),...e.components};return l?(0,r.jsx)(l,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,l,n)=>{n.d(l,{R:()=>t,x:()=>s});var i=n(6540);const r={},o=i.createContext(r);function t(e){const l=i.useContext(o);return i.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(r):e.components||r:t(e.components),i.createElement(o.Provider,{value:l},e.children)}}}]);