I want to get the content type name instead of the file name: I have this function that access to the files folder: site/all/default/files and get all the file with a text extension and put the text files in an array, is there a possibilty to retun all content types names that contain text files instead of the text files names?
function get_projects(){
$directory= variable_get('file_directory_path', 'sites/default/files');
$filenames = array();
$extension =".txt";
$iterator = new DirectoryIterator($directory);
foreach ($iterator as $fileinfo) {
if ($fileinfo->isFile()) {
//check the extension ".txt"
if (strpos($fileinfo->getFilename(),'.txt') !== false)
{
//Delete the extension ".txt"
$filenames[$fileinfo->getMTime()] =substr($fileinfo->getFilename(), 0, -4);
//$filenames[$fileinfo->getMTime()] =$fileinfo->getFilename();
//$fileinfo->getFilename().get
}
}
}
return $filenames;
}