lundi 20 août 2018

why jpg file are saved as tmp in laravel 5.1

OK i'm new in Laravel and i need any help in my code. 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></td>
                <td></td>
                <td><img src=""></td>
                    </tr>
                    @endforeach

this is result in phpmyadmin



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire