How do I can search through uploaded files with Laravel by pattern?
I tried Storage::files('uploads/daisjdas09js_*')
do not works
I know, i can get all files as array and then filter out, also i can each upload register to database and then search from database.
Is worth it create table? Or array filter do not takes to much memory?
Laravel version is 5.3
According to the doc at FileSystem:
Its clear that, using Storage::files()
would return the Files list in that directory as a string or file path/name:
given you something like:
array:3 [▼
0 => "evaluation/.DS_Store"
1 => "evaluation/sample.json"
2 => "evaluation/sample_text.txt"
]
//note it excludes the subdirectories and files in subdirectories
If you want all the file lists also in subdirectories then use Storage::allFiles($directory)
.
Since you now have it you can then do the check based on the returned values, then do the filter by your self.