$files = $request->file('file');
foreach ($files as $file){
$filename = time().'.'.$file->getClientOriginalExtension();
$location = public_path('uploads/'.$filename);
$request->file->move(public_path('/uploads'), end($filename));
$filename_arr = [];
array_push($filename_arr, $filename);
$filename = json_encode($filename_arr);
$upload->filename = $filename;
}
我已经在线检查了其他几个代码,但它们似乎工作正常,但我一直说不能在阵列上使用移动
答案 0 :(得分:1)
您正在使用SELECT [...] WHERE taxonomies.id = 11
AND taxonomies.id = 12
AND taxonomies.id = 13
数组而不是数组的$request->file
元素。所以,改变这个:
$file
要:
$request->file->move(public_path('/uploads'), end($filename));