I have a small problem concerning the resizing process of a given image, I am trying to submit a form containing an input type -->file<-- I was able to upload a picture witho
This problem can also occur when you don't want to name the uploaded file using
$filename = $file->getClientOriginalName();
method. If you want to create your own uploaded file names, let's say, using the method below
// $filename_without_ext = $request->input('name');
$filename_without_ext = Str::slug($request->input('name'));
$file_extension = pathinfo($logo->getClientOriginalName(), PATHINFO_EXTENSION);
$filename = time() . '-' . $filename_without_ext . '.' . $file_extension;
If you use Laravel 5.8 and you get that error and you are trying to create your own file name, which is mostly necessary, you can fall into this trap. You should check the name field if it is coming as a form input. For example for the code above if you don't use the Str::slug function, which is a Laravel helper function, like the code with comments, you can run into problems because of the white space that the form field can have.