I’m trying to return files from a plugin endpoint, but:
'pattern' => 'shop/download',
'auth' => false,
'method' => 'GET',
'action' => function () {
$data = $_GET;
$key = $data['key'];
$hash = $data['hash'];
...
$name = $file->name();
$extention = $file->extension();
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"$name.$extention\"");
return $file->download();
},
Doesn’t return any value. While the header
it does apply to the response headers.