I’m trying to get an image from the web and store it locally in my ‘app/library’ folder using Laravel 9. After battling for an hour with get_file_contents, I finally discovered guzzler and the file is fetched properly. Now I’m trying to save it using the following command.
$stored = Storage::put(storage_path('app/library').'/'.$filename, $content)'
$stored shows as ‘1’, which leads me to think that it’s worked, but the file is not in my app/library folder. Nor can I find any file with the correct name anywhere in my project.
Is there something wrong with my command?
2
Answers
Thanks to lagbox for the answer. I was overthinking it and didn't need 'storage_path()'. The following worked.
Run the
storage:link
command.See https://laravel.com/docs/9.x/filesystem#the-public-disk