Answer the question
In order to leave comments, you need to log in
How to create or check if a folder exists before uploading a file?
Controller:
if($request->hasFile('image'))
{
$image = $request->file('image');
$filename = time().'.'.$image->getClientOriginalExtension();
$location = public_path('files/images/blog/' . $filename);
\Illuminate\Support\Facades\File::makeDirectory($location);
Image::make($image)->save($location);
}
mkdir(): No such file or directory
Answer the question
In order to leave comments, you need to log in
check: www.php.su/file_exists
create: php.net/manual/ru/function.mkdir.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question