On Fri, Feb 4, 2011 at 2:50 AM, newguy <[email protected]> wrote: > Hi I did what was suggested in the above post and now this is my > download function: > > function download ($slug = null) > { > $this->view = 'Media'; > $params = array( > 'id' => 'example.zip, > 'name' => 'example', > 'download' => true, > 'extension' => 'zip', > 'path' => APP . 'gamefiles' . DS); > > $this->set($params); > } > I have three more links on whose click 3 different files should be > downloded using this very download function, how should I make use of > this slug to download different files. Should it be this: ??? > > function download ($slug = null) > { > $this->view = 'Media'; > $params = array( > 'id' => $slug, > 'name' => 'example', > 'download' => true, > 'extension' => 'zip', > 'path' => APP . 'gamefiles' . DS); > > $this->set($params); > }
Are all of the files going to be zips? Because you've hard-coded the extension here. Are your downloadable files recorded in the DB? If so, save the extension for each record. Use the $slug to fetch the desired file's data. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
