Saturday, January 3, 2009

Return compressed XML

Hi,

I want to return unique compressed XML for each user request.
Something like this in the controller:

public function download()
{
$filename = 'some_temporary_file_name.gz';
$this->view = 'Media';
$params = array(
'id' => $filename,
'name' => 'some_temporary_file_name',
'download' => true,
'extension' => 'gz',
'path' => ''
);

// open file for writing with maximum compression
$zp = gzopen($filename, "w9");
// write string to file
gzwrite($zp, $unique_xml_here);
// close file
gzclose($zp);
}

How can I create a unique file for each request and have the file be
deleted after the user downloaded it? I'm mostly concerned with the
deleting part unless there is a convenient CakePHP for the unique file
part.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: