Skip to content

Commit 45a8cd0

Browse files
authored
Merge pull request #1 from jai-k-gohil/jai-k-gohil-patch-1
Added methods for retrieving uploaded file details
2 parents d2ba432 + 867a6d6 commit 45a8cd0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

filesystem.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,16 @@ You may also use the `putFileAs` method on the `Storage` facade, which will perf
326326

327327
> {note} Unprintable and invalid unicode characters will automatically be removed from file paths. Therefore, you may wish to sanitize your file paths before passing them to Laravel's file storage methods. File paths are normalized using the `League\Flysystem\Util::normalizePath` method.
328328
329+
#### Retrieving File Name
330+
331+
If you would like to get original name of the uploaded file you can do so, by using `getClientOriginalName` method, which returns the file name along with it's extension.
332+
333+
$filename = $request->file('avatar')->getClientOriginalName();
334+
335+
You may also get only the file extension for getting the type of file by using `extension` method as shown in example below:
336+
337+
$filename = $request->file('avatar')->extension();
338+
329339
#### Specifying A Disk
330340

331341
By default, this method will use your default disk. If you would like to specify another disk, pass the disk name as the second argument to the `store` method:

0 commit comments

Comments
 (0)