mirror of
https://github.com/grocy/grocy.git
synced 2026-04-03 19:36:16 +02:00
Added: Date time string to filename
This commit is contained in:
parent
1cdfbb08d8
commit
9685c60e8f
|
|
@ -12,8 +12,10 @@ class ExportController extends BaseController
|
||||||
|
|
||||||
if (file_exists($databasePath))
|
if (file_exists($databasePath))
|
||||||
{
|
{
|
||||||
|
$dateTimeString = date('Y-m-d-H:i:s');
|
||||||
|
|
||||||
$response = $response->withHeader('Content-Type', 'application/octet-stream');
|
$response = $response->withHeader('Content-Type', 'application/octet-stream');
|
||||||
$response = $response->withHeader('Content-Disposition', 'attachment; filename="grocy.db"');
|
$response = $response->withHeader('Content-Disposition', "attachment; filename=\"grocy-$dateTimeString.db\"");
|
||||||
$response = $response->withHeader('Content-Length', filesize($databasePath));
|
$response = $response->withHeader('Content-Length', filesize($databasePath));
|
||||||
$response->getBody()->write(file_get_contents($databasePath));
|
$response->getBody()->write(file_get_contents($databasePath));
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user