Laravel get file name from folder with File method

Cant figure out how to get file name from folder in ````filePath```

use Illuminate\Support\Facades\File;

$filePath = storage_path('app/apiFiles/'.auth()->user()->id_message.'/');

$fileName = File::files($filePath);

dd($fileName);

dd($fileName) return array but i need only filename is possible to separated from array?

what i need from array is only this filename: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip"

 array:1 [▼
0 => Symfony\Component\Finder\SplFileInfo {#293 ▼
-relativePath: ""
-relativePathname: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip"
path: "/var/www/html/domain/storage/app/apiFiles/910960"
filename: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip"
basename: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip"
pathname: "/var/www/html/domain/storage/app/apiFiles/910960/Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip"
extension: "zip"
realPath: "/var/www/html/domain/storage/app/apiFiles/910960/Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip"
aTime: 2022-10-22 06:46:37
mTime: 2022-10-22 06:46:37
cTime: 2022-10-22 06:46:37
inode: 1308192
size: 3180822
perms: 0100644
owner: 33
group: 33
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
}

]



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3kptnd6
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time