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

Posted 8 months 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,
        ]);

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

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