samedi 4 novembre 2017

Cannot upload image in Laravel 5.2

I make input data with an upload image, my code

$name   = $request->input('name');
$images = $request->file('image');
$name_img = $images->getClientOriginalName();
$ext = $images->getClientOriginalExtension();
// Move Uploaded File
$destinationPath = 'img/';
$images->move($destinationPath,$name_img);
$path = $destinationPath.'/'.$name_img;

then put them in array, then insert in database

$data = array(
'name' => $name,
'image' => $path, );
DB::table('daftar')->insert($data);
return json_encode(array('status' =>true));

That code works in Laravel 5.1, but it doesnt work in Laravel 5.2.

Anything wrong with that code for Laravel 5.2?

Thank You. :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire