tp3.23 沒有找到同時上傳多張圖片php
手冊有講過:http://www.kancloud.cn/manual/thinkphp/1876html
其實能夠經過,多張圖片屢次上傳來到達效果thinkphp
hmlt:api
<form name="form1" action="/index.php/api/user/uploadimage" method="post" enctype="multipart/form-data"> <!-- <input type="file" name="photo[]" />--> <input type="file" name="photo[]" multiple="multiple"/> <input type="submit" /> </form>
php:post
public function uploadimage(){ $data=$this->requestdata(); echo "<pre>"; print_r($_FILES['photo']); print_r($_FILES); $upload = new \Think\Upload();// 實例化上傳類 $upload->maxSize = 113145728 ;// 設置附件上傳大小 $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 設置附件上傳類型 $upload->savePath = 'head_pic/'; // 設置附件上傳目錄 $info=array(); foreach ($_FILES['photo']['name'] as $key=>$value){ $file1=array(); $file1["photo"]['name']=$value; $file1["photo"]['type']=$_FILES['photo']["type"][$key]; $file1["photo"]['tmp_name']=$_FILES['photo']["tmp_name"][$key]; $file1["photo"]['error']=$_FILES['photo']["error"][$key]; $file1["photo"]['size']=$_FILES['photo']["size"][$key]; $info = $upload->upload(); } print_r($info); //print_r($file1);
測試過,能夠的測試