N
N
Nikolai Vasin2019-01-31 23:37:05
Laravel
Nikolai Vasin, 2019-01-31 23:37:05

Why doesn't the store method work when saving a file?

There is a construction with which I try to save several files sent from the form at once:

foreach(request()->files as $key => $file) {
      $path = $file->store('comments');
    }

Error "Call to undefined method Symfony\\Component\\HttpFoundation\\File\\UploadedFile::store()" error when executing this code
Laravel 5.7

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2019-01-31
@talam0nal

Because you need to read the documentation carefully.
For example, and return , which has this method. And this property and there are "raw" files. request()->file('photo');request()->photo;Illuminate\Http\UploadedFilerequest()->files

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question