Re: How to implement code to download files
I created a component for this - based on code I found in Textpattern CMS. Basically you pass your data (string) to the component, it creates a temporary file in the cache and feeds the contents to the user as a stream. Maybe it works for you: function download($data = null, $filename = 'download', $extension = 'tab') { if (!$data) return; $path = 'persistent' . DS . $filename . '.' . $extension; cache($path, $data); $fullpath = CACHE . $path; if (!is_file($fullpath)) { debug("Error Download: unable to create cache at $fullpath"); die; } $filesize = filesize($fullpath); $sent = 0; header('Content-Description: File Download'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . $filesize); header('Content-Disposition: attachment; filename="' . basename($path) . '"'); @ini_set("zlib.output_compression", "Off"); @set_time_limit(0); @ignore_user_abort(true); if ($file = fopen($fullpath, 'rb')) { while(!feof($file) && (connection_status() == 0)) { echo fread($file, 1024 * 64); $sent += (1024 * 64); flush(); } fclose($file); } die; } On May 6, 11:50 pm, Anil <[EMAIL PROTECTED]> wrote: > Hi, > I need the help to implement code for downloading files. If you know > how to do that, please do me the favour. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: How to implement code to download files
On Monday 07 May 2007 07:50, Anil wrote: > Hi, > I need the help to implement code for downloading files. If you know > how to do that, please do me the favour. umm just provide > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
RE: How to implement code to download files
No. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Anil Enviado el: Lunes, 07 de Mayo de 2007 02:50 a.m. Para: Cake PHP Asunto: How to implement code to download files I need the help to implement code for downloading files. If you know how to do that, please do me the favour. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
How to implement code to download files
Hi, I need the help to implement code for downloading files. If you know how to do that, please do me the favour. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---