0

I have Laradock on my MacBook.

I make php artisan storage: link

My website is this URL: http://project1.test

My website upload files to storage/.

When I open in browser: http://project1.test/storage/my-file-name.jpg I have error: 404 NOT FOUND

How can I resolve it?

Keivan Sina
  • 608
  • 5
  • 21
trafgs
  • 41
  • 3
  • 8
  • Did you try to "echo asset('storage/my-file-name.txt');" to find out your file path? – Keivan Sina Jul 06 '19 at 13:32
  • for upload and all other files which are used by the site users, the proper directory is PUBLIC. uploading the file in STORAGE is wrong. please switch to public and user publuc_path() function to access the location. – Mohammed Samgan Khan Jul 06 '19 at 13:54

1 Answers1

2

Solution 1: create a symlink

you can not access files located in storage directory directly via URL! Only files located in public folder would be available publicity. So you should make a symlink in public folder pointing the directory or file (within storage folder) you want to share. Take a look at this answer

Solution 2:

Just upload the files in public folder!

Ahmad Mobaraki
  • 7,426
  • 5
  • 48
  • 69