W
W
WebDev2017-02-09 10:34:59
Laravel
WebDev, 2017-02-09 10:34:59

storeAs method not working in Laravel 5.4?

if (request()->hasFile('image') && request()->file('image')->isValid()) {
            $data['hash']     = str_random(16);
            $data['extension'] = request()->file('image')->extension();

            $path = request()->file('image')->storeAs('storage', $data['hash'] . '.' . $data['extension']);
}

I save the file this way, but it is not saved. In $path, the path to the file is returned. The rights to directories are.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sungat Arynov, 2017-03-09
@Ginkidayo

$path = $ request()->file('image')...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question