Thommass's avatar

fileupload getting null

Im getting an error when I try to upload a file:

Call to a member function getSize() on null

    public function uploadAssesment(Request $request, Course $course)
    {
        $file = $request->bestand;
    }

 <form action="/upload/assesment/{{$course->id}}" method="POST" enctype="multipart/form-data">
                        @csrf
                        <input type="hidden" name="id" value="{{$test->id}}">
                        <input type="file" name="bestand">
                        <input type="submit">
 </form>
0 likes
1 reply
Thommass's avatar
Thommass
OP
Best Answer
Level 1

I solved it!

The problem was in the form.

When I use a <button type='submit'> instead of <input type='submit'> it works!

1 like

Please or to participate in this conversation.