Hi to all,
How can i list the files contained in a directory ?
I would like to use it with selecttag to associate a file with a
record.
The files are very big, uploaded using FTP, so no web-based uploading !
Just listing of a directory in an array.
Thanx.
you can also look in the http://api.cakephp.org/ at the Folder classyou might find that Folder::ls would be helpfulSam DOn 5/3/06,
RosSoft [EMAIL PROTECTED] wrote:
check this?php$dirname=ROOT .DS.'vendors' . DS;$dh= opendir($dirname);$files=array();while (false !== ($entry= readdir($dh))){if (
Thank you...
I modified your script like this:
?php
$dirname=ROOT .DS. 'vendors' . DS;
$dh= opendir($dirname);
$files=array();
while (false !== ($entry= readdir($dh)))
{
if ( $entry!= '..' $entry!= '.')
{
$files[$entry]=$entry;
}
}
print_r($files);
?
I can't understand how to use the Folder class...
Can you tell me how to use it or a place where it is explained ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email
So at the top of the controller you could douses('folder','file'); // loads the classes for Folder and Filethen in the controller to get an array of readable folders in a path you could do$path = WWW_ROOT.DS.'dev'.DS.'birdlists'.DS.$filename;
$folder = new Folder($path);$ls =
Atkati,
You'll find that avoiding Cake methods variables means you write
longer files ;)
To repeat what Sam D has already written using your own variable names
etc. Your script would look something like this:
uses('Folder');
$folder = new Folder (VENDORS);
$files = $folder-ls();
pr