Hi.
I have a project folder and inside this project folder I have the folder "screenshots". Via the backend, I can select the project folder. Now I want to create an array with the url all files inside the screenshots folder, but I can't open the directory :-(
Here is my code:
public function Screenshots() {
$path = $this->BaseHref().$this->ProjectFolderPath().'screenshots/';
$files = array();
if($handle = opendir($path)) {
while($file = readdir($handle)) {
if ($file != "." && $file != "..") {
array_push($files, $file);
}
}
closedir($handle);
return $files;
} else {
echo 'failed to open directory';
return false;
}
}
public function ProjectFolderPath() {
$folder = DataObject::get_by_id('Folder', $this->ProjectFolderID);
return $folder->getRelativePath();
}
Has anyone an idea of what the problem is...? Thanks in advance.
Cheers, Mario