database - Laravel 4 saving image with Dropzone -
i'm trying save images dropzone.js in laravel 4 project.
this code:
$fileinput = input::file('file'); if(input::hasfile('file')) { $filename = hash::make($fileinput->getclientoriginalname()); $path = public_path().'/images/'; $filetype = $fileinput->guessextension(); $filesize = $fileinput->getclientsize()/1024; $file = new image; $file->nombre = $filename; $file->ruta = $path; $file->tipo = $filetype; $file->size = $filesize; $file->user_id = sentry::getuser()->id; if($fileinput->move($path, $filename.'.'.$fileinput->guessextension())) { $file->save(); } }
i'm obtaining next error message:
{"error":{"type":"symfony\\component\\debug\\exception\\fatalerrorexception","message":"call undefined method intervention\\image\\facades\\image::save()","file":"\/applications\/xampp\/xamppfiles\/htdocs\/webs\/lara4\/edu1\/app\/controllers\/imagecontroller.php","line":74}}
so... problem can't save image in data base. save image in server, not in db. idea why?
thanks!
my problem had model called 'image', , i'm using intervention
. so, there conflict. i've solved changing 'image' => 'intervention\image\facades\image'
'img' => 'intervention\image\facades\image'
.
now works, don't know if practice... other suggestion?
Comments
Post a Comment