jeudi 26 mai 2016

laravel-5: loading blank screen on remote server

I'm trying to upload an image and update the image field in the database with the path

here is the code

class ApplyController extends Controller {

public function upload(){

$destinatonPath = '';
$filename = '';

$file = Input::file('image');
$destinationPath = public_path().'/assets/uploads/';
$filename = str_random(6).'_'.$file->getClientOriginalName();
$uploadSuccess = $file->move($destinationPath, $filename);

if(Input::hasFile('image')){

    Session::flash('success_insert','<strong>Upload success $filename</strong>');
    DB::table('users')->insert([
    'id'=>'',
    'image'=>'$fileName',
    ]);
    return Redirect::to('/upload');
}

}

the image is being sent to the folder however the path is not being updated to the database



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire