Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Public vs Storage directories for audio files

I am a little bit confused about in which directory I should put my .mp3 files in Laravel 5.

  • public/, my first choice as my MP3 can be considered as media (like images which are already stored there)
  • storage/app, according to docs this directory is kind of recommended for this purpose.

    enter image description here

I don't really mind being able to get an URL of these audio files since I serve it as a stream (to somehow prevent downloads, lol).

Any advice? Thanks.

like image 927
David Avatar asked Dec 07 '25 06:12

David


1 Answers

Guess it just depends on whether you want direct public access or not.

public/ is simpler. Anything in there you can link to directly. Just like your js or css or images resources.

storage/app is obviously more secure, no way to access it directly. That's what I would use (actually I think I'd do storage/app/audio to be specific) so I have more control over how they are accessed.

like image 67
jszobody Avatar answered Dec 09 '25 19:12

jszobody