FIX_ISSUE
This commit is contained in:
parent
0ac07c331e
commit
8df4731f85
@ -4245,13 +4245,13 @@ class EmployeeRestController extends AdminController
|
|||||||
$file_id = $this->request->getGet('id') ?? $id;
|
$file_id = $this->request->getGet('id') ?? $id;
|
||||||
|
|
||||||
// Find record
|
// Find record
|
||||||
$record = $this->hrFileUploadModel->find($file_id);
|
$record = $this->fileModel->where('id', $file_id)->first();
|
||||||
|
|
||||||
if (!$record) {
|
if (!$record) {
|
||||||
return $this->failNotFound("File record not found");
|
return $this->failNotFound("File record not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
$uploadPath = WRITEPATH . 'uploads/hr_files/';
|
$uploadPath = WRITEPATH . 'uploads/excel/';
|
||||||
$filePath = $uploadPath . $record['file_name'];
|
$filePath = $uploadPath . $record['file_name'];
|
||||||
|
|
||||||
if (!file_exists($filePath)) {
|
if (!file_exists($filePath)) {
|
||||||
@ -4259,8 +4259,8 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Force file download
|
// Force file download
|
||||||
return $this->response->download($filePath, null)
|
return $this->response->download($filePath, null)->setFileName($record['file_name']);
|
||||||
->setFileName($record['file_name']);
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError($e->getMessage());
|
return $this->failServerError($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user