Reputation: 505
I'm making a laravel webapp and I'm trying to access a image in a storage symbolic link /storage/images/face-ph.png
.
It works when I do it locally like this:
<img src="/storage/images/face-ph.png>
However when I upload it to Heroku it can't find the path.
Upvotes: 4
Views: 6408
Reputation: 845
Adnan's answer has two issues;
heroku run bash
to execute a command, it's only executed in a one-off dyno. So this won't affect the live dyno.php artisan storage:link
command generates a symlink with an absolute path. So when you'd run this during build, it'd map the absolute path of a temp build directory, instead of the final app's directory on the dyno.I used a simple relative symlink to link both directories and add it to your git repository:
cd public/ && ln -s ../storage/app/public storage && cd ..
Upvotes: 6
Reputation: 15951
if you are using Heroku for your deployment you can try
heroku run bash
php artisan storage:link
OR
heroku run /app/php/bin/php /app/www/artisan storage:link
you can use an absolute path or relative path to run binaries
Hope this helps
Upvotes: 4