Problem with scanning your filesystem, is that if you are doing it on
a high traffic site you will cause a lot of disk IO which can lead to
load issues.  Caching to the database will prevent thrashing the disk.

-Mark

On Dec 16, 4:11 am, r4zv4n <[email protected]> wrote:
> Thanks for the suggestion :)
>
> I was hoping there was a simpler way to do this, by simulating a data
> source as that array I'm talking about, instead of actually connecting
> to a table in a DB.
>
> The elegant solution would of course be to make a file upload script
> in admin and after uploading a new file, the table would also be
> updated. However, due to the lack of time and importance of this
> implementation, I'm just interested in a quick hack solution :)
>
> Thanks,
>
> Razvan
>
> On Dec 12, 2:42 pm, majna <[email protected]> wrote:
>
> >  Tip:
> > - use cakeFolderclass 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 afolderwhere 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to