1 year ago

File upload error (Call to a member function store() on null)

Posted 1 year ago by lawkunchi

I used the same code form Laravel Documentation in my other controller it worked fine and now it's not working in another form. Anyone with idea why I get the above error. Thanks

My Controller

public function postDeal(Request $request) 
        $this->validate($request, [
            'file' => 'required|max:2048',

        $path = $request->file('file')->store('Uploads');

        $deal = new Deal([
            'file' => $path,

My Form
form action="{{ route('deal.request')}}" method="POST" enctype="multipart/form-data">
      <input type="file" name="file" id="file">
     <button type="submit">Submit Request</button>

Please sign in or create an account to participate in this conversation.