Correct, downloading multiple files at once isn't possible without multiple HTTP requests. Best bet is to zip it up.
On Nov 19, 4:04 pm, euromark <[email protected]> wrote: > yes, zipping/packing them is one of the only changes you got. > you could open tons of popups/new windows which then each trigger a > download > or you could probably do sth similar with ajax > but thats sure not very user friendly > > On 19 Nov., 23:04, dtemes <[email protected]> wrote: > > > > > > > > > Is that possible at all? maybe you can zip all selected files together > > and let the user download just the zip file. > > > On 18 nov, 12:23, Lucas Simon Rodrigues Magalhaes > > > <[email protected]> wrote: > > > Hii, > > > > I have a doubt, how to download multiples files with cake. I have in > > > my directory webroot/files, four files. > > > form1.pdf,form2.pdf,form3.pdf,form4.pdf > > > > In my view i have this code: > > > <h1>Formulários</h1> > > > <?php echo $this->Form- > > > > >create('Formulario',array('target'=>'_blank'));?> > > > > <?php > > > > echo $this->Form->input('Formulario.selecionarFormulario', array( > > > 'div' => false, > > > 'label' => true, > > > 'type' => 'radio', > > > 'class' => 'iu02radio', > > > 'options' => array( > > > 1 => 'Form1', > > > 2 => 'Form2', > > > 3 => 'Form3', > > > 4 => 'Form4', > > > 5 => ' ', > > > 6 => '', > > > 7 => '', > > > 8 => '', > > > 9 => '', > > > 10 => 'l', > > > 11 => '', > > > 12 => ' ', > > > 13 => '', > > > 14 => '', > > > 15 => 'All forms', > > > ) > > > )); > > > > echo $this->Form->end(__('Gerar Formulario', true)); > > > ?> > > > > And, in my controller i have two actions: > > > > function gerarFormularios() { > > > > /** > > > * > > > * Recebe os valores vindos do formulario, no array > > > $this->data['Formulario']['selecionarFormulario'] > > > > * @var {Int} $opcoes > > > */ > > > $opcoes = $this->data['Formulario']['selecionarFormulario']; > > > > /** > > > * Verifica se a opcao esta vazia. caso esteja exibe uma > > > mensagem: Selecione um formulario. > > > */ > > > if (isset($opcoes) && empty($opcoes)){ > > > $this->Session->setFlash(__('Selecione um formulario', > > > true)); > > > } > > > else { > > > > /** > > > * Caso a opcao seja igual a um valor chama o metodo > > > $this->_download, para gerar o formulario em pdf > > > > */ > > > switch ($opcoes) { > > > case 1: > > > $this->_download($opcoes); > > > break; > > > > case 15: > > > > break; > > > > } > > > } > > > > } > > > > /** > > > * > > > * Metodo privado da classe para realizar o download dos > > > formularios quando solicitados > > > * pela função function gerarFormularios() > > > */ > > > function _download($opcoes) { > > > > /** > > > * Configura o debug do cakePHP para 0 (zero) > > > */ > > > Configure::write('debug',0); > > > > /** > > > * > > > * Coloca a view da função para Media > > > * @examplehttp://book.cakephp.org/pt/view/1094/Media-Views > > > * @var {String} $this->view > > > */ > > > $this->view = 'Media'; > > > > $params = array( > > > 'id' => 'form'.$opcoes.'.pdf', > > > 'name' => 'formulario'.$opcoes, > > > 'download' => true, > > > 'extension' => 'pdf', > > > 'target' => '_blank', > > > 'path' => 'files' . DS . 'ged' . DS > > > ); > > > > /** > > > * Seta os dados para visao > > > */ > > > $this->set($params); > > > > /** > > > * > > > * Nao renderiza em nenhum layout > > > * @var {boolean} $this->autoLayout > > > */ > > > $this->autoLayout = false; > > > > } > > > > How to configure, media view to download multiple files, in option > > > 15("all forms"). I am totally lost. =( -- 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
