I'm struggling with uploading files and then easily accessing them.
I've configured the storage link so anything placed in storage/app/public is visible through http://example.com/storage/ however this is where I'm having problems
The following code in my controller
$path = $request->file('docfile')->store('public'); return $path;
saves the files to the correct directory but the $path returned is
so if I save this to the database and try to link to that later the file will not be found, as the storage folder is linked, not the public folder.
If I don't put a folder name in the controller:
$path = $request->file('docfile')->store(''); return $path;
then the $path variable only contains the file name but it gets saved to storage/app so is not found by http://example.com/storage/. Using 'storage' as the folder in the controller would save the file to storage/app/storage.
What I would like is to save just the file name in the database and for the file to be saved in the correct location so it is visible from http://example.com/storage/
Going forward I would like to be able to configure a custom file structure like http://example.com/name/uploads but I need to get the basics right first!