You can put the file in the /app/webroot directory and then just reference the file's url directly.

For example when I am developing I usually keep a phpinfo.php file that just executes the phpinfo() command in the webroot.

When I want to link to it I just use http://example.com/app/webroot/phpinfo.php  The file is not processed by Cake and comes up fine.

On 7/16/06, I. E. Smith-Heisters <[EMAIL PROTECTED]> wrote:

Hi,

is there a way that a view can just dump a file without Cake doing any
processing. Right now, I sort of have it working by doing something
like this:

<?php
        if($resource['Resource']['type'] === 'include') {
                echo $this->render("files/{$location}");
                $this->autoLayout = false;
        } elseif ($resource['Resource']['type'] === 'dl') {
                $file =
"{$_SERVER['DOCUMENT_ROOT']}/app/views/resources/files/{$location}";
                $mimeType = mime_content_type($file);
                $fp = fopen($file, "rb") or die ('File not found');
                if (isset($mimeType) && strlen($mimeType) > 0)
                        header("Content-Type: $mimeType");
                header("Content-Disposition: attachment; filename=" .
basename($file));
                header("Content-Length: " . filesize($file));
                while (!feof($fp)) {
                        print fread($fp, 4096);
                }
                fclose($fp);
        }
?>

But the downloaded file is just the CakePHP page with the file contents
included within! And furthermore, this seems to be a kludgey and
unportable solution, even if I could get it working.

Is there anyway to just tell Cake to turn serving the file over to
Apache?

TIA. And sorry if this question has already been asked; I don't think I
found the right search terms.

-Ian



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to