Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hasen39's avatar

Call to a member function store() on null

i am using laravel 5.8 i want to upload file

and i get the eror call to a member function on null

here is part of my view code


                            
                            
<input type="file" name="video" id="video" class="form-control-file">               
                        
<button class="btn btn-primary"  type="submit">upload</button>
                        

and my cntroller

public function Upload_Video(Request $request){
        
        $path=$request->file('video')->store('/','public');
        if($path){
            return back()->with('upload_success','file uploaded successfully');
        }

     }

any one who help me

0 likes
3 replies
Nakov's avatar
Nakov
Best Answer
Level 73

Can you post the full form?

Are you maybe missing the enctype="multipart/form-data" attribute on your form?

4 likes

Please or to participate in this conversation.