How to upload files in laravel

0 votes
I want to upload a file that will display on user interface whenever they click on a specified buttton. So how can i upload file in Laravel?
Thank you!!
Mar 24, 2020 in Laravel by kartik
• 37,510 points
111 views

1 answer to this question.

0 votes

Hey @kartik,

We have to call Facades in our controller file with this :
use Illuminate\Support\Facades\Storage;

Example

if($request->hasFile(file_name')) {
      $file = Storage::putFile('YOUR FOLDER PATH', $request->file('file_name'));
}

Hope this is helpful!!

Thank you!!

answered Mar 24, 2020 by Niroj
• 82,720 points

Related Questions In Laravel

0 votes
1 answer

How to pass data through URL and access through controller in Laravel?

Hello, You can  first refer how to  Create controller through ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,720 points
6,419 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,720 points
289 views
0 votes
1 answer

How to mock a static facade methods in Laravel?

Hey, Facades provide a "static" interface to classes ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,720 points
1,691 views
0 votes
2 answers

How to delete or clear caching in Laravel?

You can call an Artisan command outside ...READ MORE

answered Dec 16, 2020 in Laravel by Rajiv
• 8,880 points
41,403 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,720 points
7,207 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,720 points
820 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,720 points
640 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,720 points
7,616 views
0 votes
1 answer

How to upload files in Laravel directly into public folder?

Hello @kartik, You can create a new storage ...READ MORE

answered Sep 27, 2020 in Laravel by Niroj
• 82,720 points
3,648 views
0 votes
1 answer

How to pass URL param in Laravel?

Hello, First you have to go to routes ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,720 points
2,960 views