I want to upload image in laravel 5.4 Here's the code:
if ($request->hasFile('image') && $request->image->isValid()) {
$image = $request->image;
$image_name = bcrypt($image->getClientOriginalName());
Storage::disk('public')->putFileAs('images', $image, $image_name . '.' . $image->getClientOriginalExtension());
$article->image($image_name);
}
in FilesystemAdapter.php (line 146)
I checked the FileSystemAdapter.php and saw that the problem is in this line:
$stream = fopen($file->getRealPath(), 'r+');
When I var dump the $file variable it returns the correct info, but when I var_dump($file->getRealPath();
it says bool(false)
and I can't upload the image
$image = $request->image;
to$image = $request->file('image');
– Laerte Aug 10 '17 at 16:53image
method do? – louisfischer Aug 10 '17 at 17:47