How to get file extension from input type file in laravel

Updated at 27-Jul-2021, By samar

How to get file extension from input type file in laravel

Good day, guys. In this post, we’ll look at how to solve the "How to get file extension from input type file in laravel" programming puzzle.

You can get file extension in laravel using HTTP request from input type file in HTML form.
  • Get file extension from $request in laravel

    //Inside controller's method 
    $request->file('media')->extension();
    

    You can simply get the file extension in Laravel using HTTP request. The $request provides the file path and laravel provides lots of methods to get the file properties using this method. 

Back to code snippet queries related laravel