DEV Community

Discussion on: Deploying Laravel 5 applications on shared hosting without the use of SSH

Collapse
 
silverman42 profile image
Sylvester Nkeze

After using your method to deploy my laravel app, all the pages loaded clean and easy. Big thanks for that bro. Although i have an issue with files i store in the storage/app/public directory. Uploading images to that directory is always successful but it seems impossible for me to view images from that directory to the blade view

Storage::disk('local')->url('file.jpg') seems to work on my local server but does not work on the remote server.

I did not use asset('storage/file.jpg') because I am not permitted to create a symlink on the host with ssh or php artisan

Collapse
 
edetscript profile image
Abednego Edet • Edited

Let us take a look at the default Laravel 5 application structure:

app //directory
contains restricted server-side application data

app/storage //directory
contains a writeable directory used by Laravel 5 and custom functions to store data ( i.e. log files, etc... )

public //diectory
this directory is accessible to anyone on the web.

If I were you, I would upload the file to the public directory directly.

Try this:

  1. Store image here: public_path() . 'img/filename.jpg'
  2. Save the 'img/filename.jpg' in database
  3. Generate the image URL with url('img/filename.jpg') Output // http://www.your-domain.com/img/filename.jpg

Some comments have been hidden by the post's author - find out more