K
K
Knyashshsh2018-05-04 21:25:33
Laravel
Knyashshsh, 2018-05-04 21:25:33

How to change the location where the files are saved?

Image save code

$request->file('cover_image')->storeAs('/storage/cover_images', $fileNameToStore);

and the folder tree (lsapp has everything except the public folder, and public_html is the same public)
5aeca40a6bc5f506684166.png
The problem is that when the folder structure changes to this, the files are saved in lsapp/storage/app/storage/cover_image
But it should be in public_html/storage/cover_image
When trying to change the save folder to
$request->file('cover_image')->storeAs('../../storage/cover_images', $fileNameToStore);

gives
Path is outside of the defined root, path: [../../storage/cover_images/123_1525452472.jpg]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Kolesnikov, 2018-05-04
@fyapy

Add your drive to config/filesystems.php with the right address and use it
stackoverflow

T
Tesla, 2018-05-05
@Tesla

Open documentation and read filesystem#configuration

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question