opensupports/server/controllers/system/download.php

24 lines
651 B
PHP
Raw Normal View History

<?php
use Ifsnop\Mysqldump as IMysqldump;
use Respect\Validation\Validator as DataValidator;
class DownloadController extends Controller {
const PATH = '/download';
public function validations() {
return [
'permission' => 'staff_1',
'requestData' => [
'file' => [
'validation' => DataValidator::alnum('_.')->noWhitespace()
]
]
];
}
public function handler() {
$fileDownloader = FileDownloader::getInstance();
$fileDownloader->setFileName(Controller::request('file'));
$fileDownloader->download();
}
}