prashantkumbhar's avatar

How to image upload in the folder

How to image upload in the folder. I was image capture using the webcam that capture image how to store in the folder. following are the controller code. please give me solution

    if (Input::get('mydata')) 
    {
        $location = "uploads/profile/";
        $binary_data  = Input::get('mydata');
        $fileInstance = base64_decode($binary_data);
        $newFileName = "profile_".$User->id.".jpg";
        //$file = $fileInstance->move('uploads/profile/',$newFileName);
        $file = $fileInstance->move_uploaded_file($newFileName,$location);
        $User->photo = "profile_".$User->id.".jpg";
        $User->save();
    }
0 likes
8 replies
extjac's avatar

did you try this?

$filename= request()->file('avatar')->store('public/avatars/2');

prashantkumbhar's avatar

yes i was try but error like

[26-Sep-2016 12:38:24 UTC] PHP Fatal error: Call to undefined function request() in /home/puretcms/public_html/gymcrm/app/controllers/StudentsController.php on line 663

bugsysha's avatar

What version is this?

app/controllers/StudentsController.php
prashantkumbhar's avatar

actually i want capture image via web cam and upload that image in the folder. please help me on that

jlrdw's avatar

You really need to search the forum this topic has been clearly covered previously.

prashantkumbhar's avatar
Level 1

i was search in the previous forum but nothing found anything about that

Please or to participate in this conversation.