FIX_DOWNLOAD_ISSUE

This commit is contained in:
VENKATESHWARAN 2026-05-13 13:00:24 +05:30
parent c2c4c18faf
commit 20329dfa20

View File

@ -5065,6 +5065,27 @@ class PolicyTransactionController extends BaseController
}
}
public function downloadInsurerStatement($id)
{
$statement = $this->insurerStatements
->where('id', (int) $id)
->where('is_active', 1)
->first();
if (empty($statement) || empty($statement['file_name'])) {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound('Statement file not found');
}
$fileName = basename($statement['file_name']);
$filePath = WRITEPATH . 'uploads/statements/' . $fileName;
if (!is_file($filePath)) {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound('Statement file not found');
}
return $this->response->download($filePath, null)->setFileName($fileName);
}
public function getFileErr()
{
$file_id = $this->request->getUri()->getSegment(4);