1 year ago

Laravel 5.6 request->file returns null and cannot store files

Posted 1 year ago by raducu.mirescu

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">
                <input type="file" name="xml">
                <input type="Submit" class="btn btn-primary" value="Send">

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!

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