Level 50
include enctype="multipart/form-data" to your form
<form action="/upload" method="post" enctype="multipart/form-data">
3 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to upload files from my app but for some reasons I get " Call to a member function store() on null ". I have created the storage:link.
This is my view:
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<form action="/upload" method="post">
@csrf
<input type="file" name="xml">
<input type="Submit" class="btn btn-primary" value="Send">
</form>
</div>
</div>
</div>
And my controller:
public function upload(Request $req)
{
$path = $req->file('xml')->store('xml');
return $path;
}
Is there something I'm missing or doing wrong?
Thank you!
include enctype="multipart/form-data" to your form
<form action="/upload" method="post" enctype="multipart/form-data">
Please or to participate in this conversation.