How do I setup a route for containing a dot in the query path

32 views Asked by At

http://localhost:9000/get/123/123/123.tar

Code:

require 'vendor/autoload.php';
$f3 = \Base::instance();

$f3->route('GET /get/*/*/*',
    function ($f3,$params) {
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="' . $params[3] . '"');
        header('Content-Length: ' . filesize(__DIR__ . '/tmpfile'));
        readfile(__DIR__ . '/tmpfile');
    }
);
$f3->run();

it gave me a 404 error, only http://localhost:9000/get/123/123/123 is available

I want f3 to serve the tmpfile as http://localhost:9000/get/123/123/123.tar

0

There are 0 answers