Hi, I need redirect user to another site. Here’s the code:
public function actionDownload() {
$model = $this->loadModel();
if ($model->isValidForGoogle()){
$this->redirect($model->fileGoogleLink); //!!! error here
Yii::end();
} else {
$file = $model->getFileLocation($model->fileLocalPath);
header('Content-type: '.$model->fileMime);
header('Content-Disposition: attachment; filename="'.$model->fileDisplayName.'"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
Yii::end();
}
}
It returns the page:
olor='#eeeeec' align='right'>2464556</td><td bgcolor='#eeeeec'>CInlineFilter->filter( )</td><td title='/var/www/yii/framework/web/filters/CFilterChain.php' bgcolor='#eeeeec'>../CFilterChain.php<b>:</b>126</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>0.1994</td><td bgcolor='#eeeeec' align='right'>2464780</td><td bgcolor='#eeeeec'>CController->filterAccessControl( )</td><td title='/var/www/yii/framework/web/filters/CInlineFilter.php' bgcolor='#eeeeec'>../CInlineFilter.php<b>:</b>59</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>10</td><td bgcolor='#eeeeec' align='center'>0.2085</td><td bgcolor='#eeeeec' align='right'>2549424</td><td bgcolor='#eeeeec'>CFilter->filter( )</td><td title='/var/www/yii/framework/web/CController.php' bgcolor='#eeeeec'>../CController.php<b>:</b>999</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>11</td><td bgcolor='#eeeeec' align='center'>0.2379</td><td bgcolor='#eeeeec' align='right'>2789836</td><td bgcolor='#eeeeec'>CFilterChain->run( )</td><td title='/var/www/yii/framework/web/filters/CFilter.php' bgcolor='#eeeeec'>../CFilter.php<b>:</b>41</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>12</td><td bgcolor='#eeeeec' align='center'>0.2379</td><td bgcolor='#eeeeec' align='right'>2789900</td><td bgcolor='#eeeeec'>CController->runAction( )</td><td title='/var/www/yii/framework/web/filters/CFilterChain.php' bgcolor='#eeeeec'>../CFilterChain.php<b>:</b>129</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>13</td><td bgcolor='#eeeeec' align='center'>0.2379</td><td bgcolor='#eeeeec' align='right'>2790040</td><td bgcolor='#eeeeec'>CInlineAction->run( )</td><td title='/var/www/yii/framework/web/CController.php' bgcolor='#eeeeec'>../CController.php<b>:</b>300</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>14</td><td bgcolor='#eeeeec' align='center'>0.2379</td><td bgcolor='#eeeeec' align='right'>2790188</td><td bgcolor='#eeeeec'>FileController->actionDownload( )</td><td title='/var/www/yii/framework/web/actions/CInlineAction.php' bgcolor='#eeeeec'>../CInlineAction.php<b>:</b>32</td></tr>
</table></font>
HTTP/1.1 302 Found
Date: Fri, 16 Jul 2010 11:47:06 GMT
Server: Apache/2.2.12 (Ubuntu)
X-Powered-By: PHP/5.2.10-2ubuntu6.4
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://docs.google.com/a/inf-derby.co.uk/document/edit?id=1I6lQu75yZ1DL7lM2N7qEbd9MbHpMk7OmEfdy0xUqz64&hl=en
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Content-Type: text/html
‹���������������