Volatil3
Volatil3

Reputation: 14978

Laravel: How to get URLs of uploaded files?

I have created an upload folder at the same level of app and storing uploaded files there. Now I need to access those file via browser so need to have an http:// based address.

First, am I doing right? What are Laravel 5.1's recommendation? Where should files be stored? If no recommendation then how do I get ULRs?

Upvotes: 0

Views: 2882

Answers (2)

Narendrasingh Sisodia
Narendrasingh Sisodia

Reputation: 21437

Store the files within your public folder create uploads folder and then you can simply access from there using asset() function like as

asset("uploads/your_file")

Upvotes: 2

Anshul Gupta
Anshul Gupta

Reputation: 26

You can use Request::root() to get the root URL of your website and then simply use Request::root()."/uploads/your_file"

Upvotes: 0

Related Questions