Here is my Controller
public function store()
{
$data = Request::all();
$rules = [
'password' => 'required|confirmed|min:3',
'avatar' => 'required|image|mimes:jpeg,png,bmp',
'email' => 'required|email|unique:users',
'first_name' => 'required',
'last_name' => 'required',
'level' => 'required'
];
$validator = validator::make($data, $rules);
if($validator->passes()){
if(!file_exists(public_path("assets/uploads".date('/Y/m/d/').$data['avatar']->getClientOriginalName()))){
$path = public_path("assets/uploads".date('/Y/m/d/').$data['avatar']->getClientOriginalName());
Image::make($data['avatar']->getRealPath())->resize(200, 200)->save($path);
}
}
}
And Here is my error
Can't write image data to path (/var/www/html/rnd/public/assets/uploads/2015/10/16/tes.jpg)
There is no 2015
folder inside uploads
folder, so it should create automatically if folder doesn't exists.
Please correct whats wrong with my code?
Any help appreciated.