Laravel get name of file

In Laravel, you can use the getClientOriginalName() method to retrieve the original file name of an uploaded file. Here is an example of how to use it:

$file = $request->file('file');
$fileName = $file->getClientOriginalName();

Watch a course Learn object oriented PHP

In this example, $file is the uploaded file and $fileName will contain the original file name. The file in $request->file('file') refers to the key of file in the $_FILES array.