added an image file for transfer and chagnes to api

This commit is contained in:
prototrip 2021-08-07 14:37:55 +03:00
parent d5ecd60790
commit c6c7915e52

View File

@ -10,16 +10,13 @@ $api->count = 4; // process count
$api->any('/', function ($requst) { $api->any('/', function ($requst) {
$filename = "wifi.png"; $filename = "wifi.png";
$attachment_location = $_SERVER["DOCUMENT_ROOT"] . $filename;
$headers = []; $headers = [];
if (file_exists($attachment_location)) { if (file_exists($filename)) {
$headers[] = $_SERVER["SERVER_PROTOCOL"] . " 200 OK";
$headers[] = "Cache-Control: public"; $headers[] = "Cache-Control: public";
$headers[] = "Content-Type: application/png"; $headers[] = "Content-Type: image/png";
$headers[] = "Content-Transfer-Encoding: Binary"; $headers[] = "Content-Transfer-Encoding: Binary";
$headers[] = "Content-Length:".filesize($attachment_location); $headers[] = "Content-Length:".filesize($filename);
$headers[] = "Content-Disposition: attachment; filename={$filename}"; $headers[] = "Content-Disposition: attachment; filename={$filename}";
die(); die();
} else { } else {