note 85982 added to function.readfile
| From: | johniskew at osu1 dot php dot net | Date: | Fri, 26 Sep 2008 19:17:21 +0000 |
| Subject: | note 85982 added to function.readfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144824@lists.php.net to get a copy of this message | ||
@marks suggestion-
That is one way to do it, however this is avoidable. For example in Zend Framework you could do
<?php
// Action controller
public function someAction() {
$response = $this->_response;
// Disable view and layout rendering
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout()->disableLayout();
// Process the file
$file = 'whatever.zip';
$bits = @file_get_contents($file);
if(strlen($bits) == 0) {
$response->setBody('Sorry, we could not find requested download file.');
}
else {
$response->setHeader('Content-type', 'application/octet-stream',
true);
$response->setBody($bits);
}
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 158.118.51.2
----
Manual Page -- http://www.php.net/manual/en/function.readfile.php
Edit -- https://master.php.net/note/edit/85982
Del: integrated -- https://master.php.net/note/delete/85982/integrated
Del: useless -- https://master.php.net/note/delete/85982/useless
Del: bad code -- https://master.php.net/note/delete/85982/bad+code
Del: spam -- https://master.php.net/note/delete/85982/spam
Del: non-english -- https://master.php.net/note/delete/85982/non-english
Del: in docs -- https://master.php.net/note/delete/85982/in+docs
Del: other reasons-- https://master.php.net/note/delete/85982
Reject -- https://master.php.net/note/reject/85982
Search -- https://master.php.net/manage/user-notes.php