read file

This commit is contained in:
CHIEFSOFT\ameye
2023-08-10 17:59:15 -04:00
parent fe6af677c4
commit 107e1e4d1f
+22 -7
View File
@@ -30,13 +30,28 @@ class WrenchMedia extends BaseController
public function apigate(){
$file = __DIR__ . DIRECTORY_SEPARATOR . "books.png";
$fileData = exif_read_data($file);
ob_start();
header("Content-Type: " . $fileData["MimeType"]);
header("Content-Length: " . $fileData["FileSize"]);
readfile($file);
ob_end_flush();
// $file = __DIR__ . DIRECTORY_SEPARATOR . "books.png";
// $fileData = exif_read_data($file);
// ob_start();
// header("Content-Type: " . $fileData["MimeType"]);
// header("Content-Length: " . $fileData["FileSize"]);
// readfile($file);
// ob_end_flush();
$file = 'books.png';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
exit;
}
}
public function apigate33(){