将文件从Laravel上传到AWS S3时出现响应错误。
//File upload controller
public function upload_course_image(Request $request){
$file_validation = Validator::make($request->all(), [
'file' => 'mimetypes:image/jpeg,image/png',
]);
if($file_validation->fails()){
return response()->json([$file_validation->errors()->all()],422);
}
else{
//dd($request->file);
Storage::disk('s3')->put('images', $request->file);
}
}
"errors":"Sorry, something went wrong.","exception":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Uncaught InvalidArgumentException: Type is not supported in C:\\xampp\\htdocs\\learn\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\JsonResponse.php:75\nStack trace:\n#0 C:\\xampp\\htdocs\\learn\\vendor\\symfony\\http-foundation\\JsonResponse.php(50): Illuminate\\Http\\JsonResponse->setData(Array)\n#1 C:\\xampp\\htdocs\\learn\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\JsonResponse.php(31): Symfony\\Component\\HttpFoundation\\JsonResponse->__construct(Array, 400, Array)\n#2 C:\\xampp\\htdocs\\learn\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ResponseFactory.php(99): Illuminate\\Http\\JsonResponse->__construct(Array, 400, Array, 0)\n#3 C:\\xampp\\htdocs\\learn\\app\\Exceptions\\Handler.php(83): Illuminate\\Routing\\ResponseFactory->json(Array, 400)\n#4 C:\\xampp\\htdocs\\learn\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(123): App\\Exceptions\\Handler->render(Object(Illuminate\\Http\\Request), Object(InvalidArgumentException))\n#5 C:\\xampp\\htdocs\\learn\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\Ha","trace":[]}
任何人都可以指出哪里出了问题吗?