Init PercoVitrine — app de gestion de fiches produits
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require __DIR__ . '/includes/db.php';
|
||||
|
||||
$f = basename($_GET['f'] ?? '');
|
||||
if (!$f) { http_response_code(400); exit; }
|
||||
|
||||
$path = $UPLOAD_DIR . $f;
|
||||
if (!is_file($path)) { http_response_code(404); exit; }
|
||||
|
||||
$ext = strtolower(pathinfo($f, PATHINFO_EXTENSION));
|
||||
$mime = match($ext) {
|
||||
'jpg','jpeg' => 'image/jpeg',
|
||||
'png' => 'image/png',
|
||||
'gif' => 'image/gif',
|
||||
'webp' => 'image/webp',
|
||||
'avif' => 'image/avif',
|
||||
'mp4' => 'video/mp4',
|
||||
'webm' => 'video/webm',
|
||||
'mov' => 'video/quicktime',
|
||||
default => 'application/octet-stream',
|
||||
};
|
||||
|
||||
header('Content-Type: ' . $mime);
|
||||
header('Cache-Control: public, max-age=86400');
|
||||
header('Content-Length: ' . filesize($path));
|
||||
readfile($path);
|
||||
Reference in New Issue
Block a user