FIX_DOWNLOAD_ISSUE
This commit is contained in:
parent
c2c4c18faf
commit
20329dfa20
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user