I need to download file from folder /uploads, but I just get timeOut error when the action is called, Anyone can help me :(
public function actionDownload() {
$path = Yii::getAlias('@webroot') . '/uploads';
$file = $path . '/1.pdf';
if (file_exists($file)) {
Yii::$app->response->sendFile($file);
}
}
If a download takes too much time, I see 2 possibilities
ini_set('max_execution_time', 5*60); // 5 minutes
if (file_exists($file)) {
Yii::$app->response->xSendFile($file);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With