I am trying to get a count of files inside a folder in my CodeIgniter project, I did the following:
<?php
$fi = new FilesystemIterator(base_url().'uploads', FilesystemIterator::SKIP_DOTS);
printf("There were %d Files", iterator_count($fi));
?>
but this gives me the following error:
FilesystemIterator::__construct(http://localhost/drive/uploads): failed to open dir: not implemented
can anyone please tell me what is wrong in here, thanks in advance
I have fixed it using DIR attribute in php and then giving the path inside a variable
<?php
$upOne = realpath(__DIR__ . '/../../../uploads');
$fi = new FilesystemIterator($upOne, FilesystemIterator::SKIP_DOTS);
printf("There were %d Files", iterator_count($fi));
?>