C
C
Cathari2020-10-19 14:55:40
Laravel
Cathari, 2020-10-19 14:55:40

Error: “mime_content_type(): Can only process string or stream arguments”?

I want to make the distribution of files when uploading to different collections (pictures to pictures, videos to videos, etc.). Here is the method itself, with a single comparison, as an example:

public function uploadFile(Request $request)
    {
        if($request -> hasFile('file')) {
            $task = Task::find(1);
            if( mime_content_type($request) == 'image/png') {
                $task->addMedia($request->file('file'))->toMediaCollection('images');
            }
        }
    }


gives error mime_content_type(): Can only process string or stream arguments

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question