read file
This commit is contained in:
@@ -30,13 +30,28 @@ class WrenchMedia extends BaseController
|
|||||||
|
|
||||||
public function apigate(){
|
public function apigate(){
|
||||||
|
|
||||||
$file = __DIR__ . DIRECTORY_SEPARATOR . "books.png";
|
// $file = __DIR__ . DIRECTORY_SEPARATOR . "books.png";
|
||||||
$fileData = exif_read_data($file);
|
// $fileData = exif_read_data($file);
|
||||||
ob_start();
|
// ob_start();
|
||||||
header("Content-Type: " . $fileData["MimeType"]);
|
// header("Content-Type: " . $fileData["MimeType"]);
|
||||||
header("Content-Length: " . $fileData["FileSize"]);
|
// header("Content-Length: " . $fileData["FileSize"]);
|
||||||
readfile($file);
|
// readfile($file);
|
||||||
ob_end_flush();
|
// 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(){
|
public function apigate33(){
|
||||||
|
|||||||
Reference in New Issue
Block a user