Why does thinkphp5 always report errors when uploading multiple files using the multiple attribute?
error message:
HTML Code:
<input name="file" type="file" multiple/>
<input type="submit" value="" class="btn btn-primary">
php Code:
if($files = request()->file("file"))
foreach ($files as $file)
{
$info = $file->move(ROOT_PATH . "public" . DS ."static","");
if($info){
$path_parts = pathinfo(ROOT_PATH . "public" . DS . "static" ."\\". $info->getFilename());
//
$type=$path_parts["extension"];
$name=$path_parts["filename"];
$size=(filesize(ROOT_PATH . "public" . DS . "static" ."\\". $info->getFilename())>>10)."KB";
$data=["name"=>$name,"type"=>$type,"size"=>$size];
Db::table("doc")->insert($data);
$this->success("");
}else{
//
$this->error($file->getError());
}
}
I am looking at the thinkphp5 manual, why does the move function always report an error?