I'm trying to upload image in admin panel. but this image is uploading as tmp.
Need I add something other code in my code?
public function store(Request $request)
{
if ($request->hasFile('contents')) {
$destinationPath = 'pictures/SliderImages';
$files = $request->contents;
$file_name = $files->getClientOriginalName();
$files->move($destinationPath, $file_name);
echo "Complete";
} else {
echo "No File";
}
$inputs = $request->all();
$sliders = Sliders::Create($inputs);
return redirect()->action('SliderController@index');
}
this is my blade:
@foreach($sliders as $slider)
<tr>
<td>{{$slider->id}}</td>
<td>{{$slider->title}}</td>
<td><img src="{{$slider->contents}}"></td>
</tr>
@endforeach