download 2.5 bug téléchargement

This commit is contained in:
Fred Tempez 2021-09-10 08:35:21 +02:00
parent fc11676d02
commit d642560e30

View File

@ -14,7 +14,7 @@
class download extends common {
const VERSION = '2.4';
const VERSION = '2.5';
const REALNAME = 'Téléchargement';
const DELETE = true;
const UPDATE = '0.0';
@ -923,9 +923,8 @@ class download extends common {
}
// Téléchargement
else {
$filePath = self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file']);
$fileName = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file']);
if (file_exists($filePath)) {
$fileName = self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file']);
if (file_exists($fileName)) {
// Statistiques de téléchargement
$statId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'stats']));
$this->setData(['module',
@ -938,14 +937,15 @@ class download extends common {
'ip' => helper::getIp()
]]);
// Formatage http
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Content-Length: ' . filesize($filePath));
readfile( $filePath);
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_RAW
]);
header('Content-Disposition: attachment; filename="'.basename($fileName).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($fileName));
readfile($fileName);
exit;
} else {
// Valeurs en sortie
$this->addOutput([