Tip: - use cake Folder class methods for files collection and infos - save all files info in database table. - paginate from this table. - you can save last scan time somewhere and scan files, for exmpl, every 5 min.
On Dec 12, 11:09 am, r4zv4n <[email protected]> wrote: > Hello, > > I have a folder where files are manually uploaded via FTP in the > format "YYYYMMDD-YYYYMMDD.pdf". > > The task is to display these files in a table that will have these > fields: "link to file", "start date", "end date", "file size". I will > also need to paginate the results and sort by dates / size. > > I've currently done this by using a controller in which I scan the > folder, parse the file names and return an array slice to the view, in > this format: > > foreach (glob($path_to_files) as $file) { > $file_name = substr( $file, ( strrpos( $file, "/" ) +1 ) ); > $file_list[$i++] = array ( > 'path'=> $file, > 'name' => $file_name, > 'size' => filesize($file), > 'start' => substr($file_name, > 6,2).'/'.substr($file_name, > 4,2).'/'.substr($file_name, 0,4), > 'end' => substr($file_name, > 15,2).'/'.substr($file_name, > 13,2).'/'.substr($file_name, 9,4) > ); > } > > I then display the data in the view and use some custom functionality > for paginating. > > However, I'm thinking there has to be a better way to do this and use > Cake's functions for paginating, sorting, etc. > > How would I feed the data in the format above to a model? I only need > "find all" functionality, no add, delete, edit. > > Thanks in advance for any info, > > Razvan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
