Artirigo's avatar

InvalidArgumentException: An uploaded file must be an array or an instance of UploadedFile.

Hello everyone, I am currently trying to test one of my site routes where a user uploads a photo. I keep on getting this same error and I am not sure what is wrong with my POST request. Any help would be greatly appreciated. Here is the code I have

        $path  = './public/uploads/B.png';  
        $original_name  = 'B.png'; 
        $mime_type  = 'image/png'; 
        $size  = 600;  
        $error   = null;  
        $test   = true; 
        $file = new UploadedFile($path, $original_name, $mime_type, $size, $error, $test); 
    $this->call('POST', '/api/v1/ask', ['user' => "me" , "id" => 1], ['image' => $file], ['HTTP_Authorization' => 'Bearer' . $token] ) ;   
0 likes
2 replies
Artirigo's avatar

Oops I spoke too soon, still getting the same error, didn't read the error logs close enough

Please or to participate in this conversation.