added an image file for transfer and chagnes to api

This commit is contained in:
prototrip 2021-08-07 14:40:54 +03:00
parent c6c7915e52
commit 9e5ae12454

View File

@ -18,11 +18,11 @@ $api->any('/', function ($requst) {
$headers[] = "Content-Transfer-Encoding: Binary"; $headers[] = "Content-Transfer-Encoding: Binary";
$headers[] = "Content-Length:".filesize($filename); $headers[] = "Content-Length:".filesize($filename);
$headers[] = "Content-Disposition: attachment; filename={$filename}"; $headers[] = "Content-Disposition: attachment; filename={$filename}";
die(); // die();
} else { } else {
die("Error: File not found."); die("Error: File not found.");
} }
return new Response(200, $headers, $filename); return new Response(200, $headers, readfile($filename));
}); });
$api->get('/hello/{name}', function ($requst, $name) { $api->get('/hello/{name}', function ($requst, $name) {