Answer the question
In order to leave comments, you need to log in
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');
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question