One, single file upload
<form action= "__action__" enctype= "Multipart/form-data" method= "POST" ><input type= "text" name= "name"/> <input type= "file" name= "photo"/><input type= "Submit" value= "Commit" ></form>
<?phpnamespace home\controller;use think\controller;class Logincontroller extends controller{public function login () {if (!empty ($_post)) {$upd = new \think\upload (); $upd->rootpath = "./public/"; $upd->savepath = "./upload/"; $ info = $upd->upload ();} else{$this->show ();}}}
One more folder in the file after submission
Second, multiple file upload
<form action= "__action__" enctype= "Multipart/form-data" method= "POST" ><input type= "text" name= "name"/> <input type= "file" name= "photo"/><input type= "file" Name= "photo1"/><input type= "Submit" value= "Submit" ></form>
<?phpnamespace home\controller;use think\controller;class Logincontroller extends controller{public function login () {if (!empty ($_post)) {$upd = new \think\upload (); $upd->rootpath = "./public/"; $upd->savepath = "./upload/"; $ info = $upd->upload (); Var_dump ($info);} else{$this->show ();}}}
Upload two photos
TP File Upload