0

I've uploaded my Laravel site to shared hosting (I know....), the site has a image upload section which worked previously in my local set up.

The files do upload as expected but will not show in the view, I've looked everywhere for a solution so sorry if and answer is somewhere here already.

For example , this page http://www.navigatetheplanet.co.uk/blogs/England - the image at the top of the page was previously uploaded in local and is working as expected, but right at the bottom of the page there's a post with a image attached but return 404 ... from my investigations online it looks like it's something to do with the Symlink?

  • Have you created link to storage directory (`php artisan storage:link`)? Without access to ssh you can only ask your hosting provider to do it for you. – Harven Mar 17 '19 at 13:42
  • Could you precise how you load the images and how they are stored both in your dev file system and on the server side ? – Julien Revault d'A... Mar 17 '19 at 13:44
  • @JulienRevaultd'A... thanks for responding! I'm loading them like this - where $blogpost->photolink is a string which has the folders, filename and extension. The are stored within a folder in public/storage/blogimageupload.. this is replicated on my dev and production systems – Leon Kimpton Mar 17 '19 at 14:00
  • @Harven I ran storage:link in dev, but as you rightly pointed out , I won't be able to ssh ... maybe I picked the wrong hosting service, – Leon Kimpton Mar 17 '19 at 14:01
  • Here are some workarounds to create symlinks if you can't ssh https://stackoverflow.com/questions/5589489/create-symbolic-links-on-server-without-ssh-available – Travis Britz Mar 17 '19 at 14:07

1 Answers1

0

if you don't have ssh access then simply create a route.so you can hit this command simply by hitting url

Route::get('/storage/link', function() {
    $command = 'storage:link';
    $result = Artisan::call($command);
    return Artisan::output();
})
Akash Kumar Verma
  • 3,185
  • 2
  • 16
  • 32
  • Thanks, I've tried that , I've also just tried running it locally and the images aren't showing there either so looks like I must have some config issue? – Leon Kimpton Mar 17 '19 at 18:12