How can i check if a path points to a folder or a file?

resaleman

New Member
I'm building a small class for my zend application (using MVC). This class receive either a folder path or a file path. If its a folder path, i want to list all the files in that folder to make them downloadable. If its a file i want to make a single link to this file to make it downloadable.The file/folder i'm pointing to is /zendApplicationName/Public/Models/Subfolder/File.i tried to check using\[code\]is_file('pathToFile')\[/code\]and\[code\]is_dir('pathToFolder')\[/code\]to check the path that i build using\[code\]APPLICATION_PATH . '..\public' . $this->_path . 'file.docx'\[/code\]and \[code\]$this->_baseUrl' . $this->_path . 'file.docx' // i took the baseURL from Zend_Controller_Front::getInstance()\[/code\]I also tried to use the old school php version\[code\]$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'?'https':'http';$path = $protocol . '://' . $_SERVER['HTTP_HOST'] . $this->_baseUrl . $this->_path . 'file.docx'\[/code\]Thanks in advanceEDIT :The problem is that even if the folder and the file exists, both function return false
 
Back
Top