In this video we are going to learn about File Upload.
So lets see how can we upload file in laravel 8.
So first of all lets creat a new controller.
So switch to command prompt an run the command.


php artisan make:controller UploadController


Now switch to project and open UploadController.
Here lets create a function.

public function uploadForm()
{
return view('upload');
}


Now crate this upload view.
Go to the views folder and here create a new file upload.blade.php Alright.
Now create route for this.
So goto the web.php file and here create the route.

Route::get('/upload','FileController@uploadForm');

Now open upload.blade.php file and write the following code.

<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">
<title>Upload</title>
{{-- Add here bootstrap css cdn --}}
</head>
<body>
<section style=\"padding-top:30px\">
<div class=\"container\">
<div class=\"row\">
<div class=\"col-md-8 offset-md-2 text-center\">
<form method=\"POST\" action=\"{{route('upload')}}\" enctype=\"multipart/form-data\">
@csrf
<div class=\"form-group\">
<label for=\"file\">Choose</label>
<input type=\"file\" class=\"form-control-file\" name=\"file\" id=\"file\">
</div>
<button type=\"submit\" class=\"btn btn-success\"name=\"submit\">Submit</a>
</form>
</div>
</div>
</div>
</section>
</body>
</html>


Now save this and lets check this form.
So switch to the browser and go to the url /upload
You can see here the form.
Now goto the UploadController and here create another function

public function uploadFile(Request $req)
{
$request->file->store('public');
return \"File has been uploaded successfully!\";
}


Now create route for this function.
So goto the web.php and here create a route.

Route::post('/upload','FileController@uploadFile')->name('upload');

Now save the file and lets check.
Refresh the page.
Now select a file and click on submit.
Ok you can here the message File has been uploaded successfully.
Now lets find this uploaded file.
So go to the project directory and open storage folder then app and public now you can see here the file.
Try one more file to upload.
So choose another file and click on submit.
File uploaded and in storage folder you can see here the new file.
So in this way you can upload files in laravel 8.