Sep 5, 2016
0
Level 1
Call to a member function getClientOriginalExtension() on array
Hello,
I try to upload multiple images and Files using intervention image with repeatable fields https://github.com/Rhyzz/repeatable-fields
ButI Got this error
Call to a member function getClientOriginalExtension() on array
My Controller
$course = Course::create($request->all());
$lessons = $request->all();
for($x = 0;$x < count($lessons['class_name']); $x++)
{
if($lessons['photos'][$x])
{
$photos = $request->file('photos');
$photo_name = '';
$name = rand(5,6).'.'.$photos->getClientOriginalExtension();
$path = public_path('images/courses/');
Image::make($photos)->save($path.$name);
$photo_name .=$name.',';
$lesson['photos'] = $photo_name;
}
if($lessons['files'][$x])
{
$files = $request->file('files');
$file_name = '';
$name = rand(5,6).'.'.$files->getClientOriginalExtension();
$path = public_path('files/courses/'.$course->id);
Image::make($files)->save($path.$name);
$file_name .=$name.',';
$lesson['files'] = $file_name;
}
$lesson->save();
}
Please or to participate in this conversation.