Hi there!
I'm trying to create a batch action (symfony admin) that enables the creation/download on the fly of zip file containing users photos which are avaialable on the uploads/images directory.
Here is the code that I already implemented:
public function executeBatchDownloadFotos(sfWebRequest $request)
{
$zip = new ZipArchive();
// atheletes identifiers
$ids = $request->getParameter('ids');
// get all the atheletes objects
$q = Doctrine_Query::create()
->from('Atleta a')
->whereIn('a.id', $ids);
foreach ($q->execute() as $atleta)
{
$zip->addFile($atleta->id . '_' . $atleta->Clube . '.jpg', 'uploads/atletas/' . $atleta->id . '_' . $atleta->Clube . '.jpg');
}
}
By the other hand, here is the view configuration:
BatchDownloadFotos:
http_metas:
content-type: application/zip
has_layout: false
For some reason, each time execute the batch action, the browser do not prompts me with the window to download the zip file.
Can anyone give some help?
Thanks in advance, Best regards!