J
J
Jedi2018-04-20 16:58:15
Laravel
Jedi, 2018-04-20 16:58:15

Error saving file. How to decide?

Error: Can't write image data to path (C:\Users\Gates\PhpstormProjects\MyProject\public\images/posts/2018-04-20/1524232525.jpg)
Code:
if ($request->hasFile('thumbnail ')) {
$thumbnail = $request->file('thumbnail');
$filename = time() . '.' . $thumbnail->getClientOriginalExtension();
Image::make($thumbnail)->resize('300', null, function ($constraint) {
$constraint->aspectRatio();
})->save(public_path('images/posts/'. Date(' Ymd') .'/' .$filename));
}
Help to solve a problem, please.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor, 2018-04-20
@v_decadence

The problem is most likely that the 2018-04-20 folder does not exist, you need to create it, the save method does not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question