2011-05-28 571 views

回答

1

該樣品直接來自軌道樣品頁/ test.op。

<form method="POST" enctype="multipart/form-data" action="test.op"> 
    <input type="file" name="file"> 
    <input type="submit" value="Upload"> 
</form> 

$lua{[[ 
    local f = web.input.file 
    upload = {} 
    if f then 
     local name = f.name 
     local bytes = f.contents 
     local dest = io.open(web.real_path .. "/" .. name, "wb") 
     if dest then 
      dest:write(bytes) 
      dest:close() 
     upload[1] = name 
     end 
    end 
]]} 

你可以很容易地適應這個正常的軌道後處理程序。你也可以看看我在library project中如何使用它,但它比我想象的典型用法複雜得多。