I fixed the problem but I want to know the best place to put uploads directory in Laravel.What are the pros and cons of putting uploads directory in public folder and outside of public folder?
If you put all uploaded files in the public folder, everyone will be able to see them.
I only want admins and superadmin to access this folder.How do I do that?
If you put them in the resources folder you'll have better control of them and show them when you need to.
Laravel docs says that it is for
"The resources directory contains your views, raw assets (LESS, SASS, CoffeeScript), and localization files."
http://laravel.com/docs/master/structure
Ok, present the uploaded files to admins and super admins only using middleware to restrict access based on roles. Maybe there's no mention of uploads because it's better to keep the files somewhere on the cloud/another server and just show them when needed. I forgot about that!
@laraDev98 and @Ruffles shouldn't uploads be placed in the storage directory if not in the public directory? I am just thinking in terms of how Envoyer handles things but it makes sense.
Your version specific code lives within the project structure, and your constants (resources, whether that is uploaded etc) live within a storage directory. Anyway, I'm just thinking out loud.
@andreasb thanks for quick reply, but because I'm working with REST so I'd like to get an URL to that file, so client can easily access to it . E.g an image
Hmm well the URL you can very easily generate yourself - and then serve the image you have stored according to the URL either by using some kind of hash or random string <> image stored in a DB.
What I dont know what should happen if the URL is called, meaning how your API works/what should be achieved
As Taylor worked on Spark he had mentioned in a blog post and podcast he is switching things up. Mainly to what @mstnorris mentioned. In the storage/public ? Folder.