function download ($id = null) {

        $file = $this->Article->find('first',
                                                    array(
                                                           'fields' =>
array('file'),
                                                           'conditions' =>
array('id' => $id),

                                                      )
                                             );
                $fl_name = $file['Article']['file'];



         $fl =  "http://localhost/uscb/app/webroot/".$fl_name;


            header('Content-Description: File Transfer');



            header('Content-Disposition: attachment;
filename='.basename($fl));

            header('Content-Transfer-Encoding: binary');

            header('Expires: 0');

            header('Cache-Control: must-revalidate, post-check=0,
pre-check=0');

            header('Pragma: public');

            header('Content-Length: ' . filesize($fl));

            ob_clean();

            flush();

            readfile($fl);

            exit;


    }


frieands this is my download code when i download it will download file 0B
please help me

--------------------------------------------------------------------
Miqdad Ali
http://www.miqdadali.co.cc




On Wed, Jan 5, 2011 at 4:23 AM, cricket <[email protected]> wrote:

> On Tue, Jan 4, 2011 at 12:21 AM, Miqdad Ali <[email protected]>wrote:
>
>> hi buddies
>>
>> anyone please send me any file download code
>> my download code not working correctly first time it download only 0B file
>> but second time it will download correct file
>>
>
> If you post some of your code perhaps we can help figure out the trouble.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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

Reply via email to