How to get public directory in laravel

+1 vote
I'm using return File::put($path , $data); to create a file in public folder on Laravel. I used this piece of code from controller I need to know the value of $path how should it be.
Aug 10, 2020 in Laravel by kartik
• 37,510 points
26,595 views

1 answer to this question.

+1 vote

Hello @kartik,

Use public_path()

For reference:

// Path to the project's root folder    
echo base_path();

// Path to the 'app' folder    
echo app_path();        

// Path to the 'public' folder    
echo public_path();

// Path to the 'storage' folder    
echo storage_path();

// Path to the 'storage/app' folder    
echo storage_path('app');

Hope this is helpfull!!

Thank You!!

answered Aug 10, 2020 by Niroj
• 82,880 points

Related Questions In Laravel

0 votes
1 answer

How to get distinct values for non-key column fields in Laravel?

Hello @kartik In eloquent you can use this $users ...READ MORE

answered Mar 30, 2020 in Laravel by Niroj
• 82,880 points
22,023 views
0 votes
1 answer

How to get a list of registered route paths in Laravel?

Hello, Route::getRoutes() returns a RouteCollection. On each element, you can ...READ MORE

answered Mar 31, 2020 in Laravel by Niroj
• 82,880 points
3,291 views
+1 vote
4 answers

How to access images inside public folder in laravel?

If you are inside a blade template {{ ...READ MORE

answered Dec 14, 2020 in Laravel by Rajiv
• 8,910 points
128,033 views
0 votes
1 answer

How to get all pending jobs in laravel queue on redis?

Hello @kartik, Here is the way I do ...READ MORE

answered Apr 6, 2020 in Laravel by Niroj
• 82,880 points
8,907 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
21,914 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,693 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,562 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
41,901 views
0 votes
1 answer

How to identify wheather the request is HTTP GET or HTTP POST in Laravel?

Hey, In order to identify the type of ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,880 points
2,782 views
+1 vote
5 answers

How to get user's IP address in Laravel?

Hey, We can get the user's IP address ...READ MORE

answered Mar 20, 2020 in Laravel by Niroj
• 82,880 points
71,199 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP