I'd like to get a list of files stored in a sub directory of the /media directory in a controller.
I tried to use this one:
$dir = Mage::getBaseDir('media') . DS . $sub_dir . DS;
$files = scandir($dir);
But the array $files is empty.
I tried something like that:
$file = new Varien_Io_File();
$dir = Mage::getBaseDir('media') . DS . $sub_dir . DS;
$file->ls($dir);
Magento says Unable to list current working directory.