src/Tus/Server.php
protected function handleDownload()
    {
        $path = explode('/', str_replace('/get', '', $this->request->path()));
        $key  = end($path);

        if ( ! $fileMeta = $this->cache->get($key)) {
            return $this->response->send('404 upload not found.', HttpResponse::HTTP_NOT_FOUND);
        }

        $resource = $fileMeta['file_path'] ?? null;
        $fileName = $fileMeta['name'] ?? null;

        if ( ! $resource || ! file_exists($resource)) {
            return $this->response->send('404 upload not found.', HttpResponse::HTTP_NOT_FOUND);
        }

        return $this->response->download($resource, $fileName);
    }
protected function handleDownload()
    {
        $path = explode('/', str_replace('/get', '', $this->request->path()));
        $key  = end($path);

        if ( ! $fileMeta = $this->cache->get($key)) {
            return $this->response->send('404 upload not found.', HttpResponse::HTTP_NOT_FOUND);
        }

        $resource = $fileMeta['file_path'] ?? null;
        $fileName = $fileMeta['name'] ?? null;

        if ( ! $resource || ! file_exists($resource)) {
            return $this->response->send('404 upload not found.', HttpResponse::HTTP_NOT_FOUND);
        }

        return $this->response->download($resource, $fileName);
    }
protected function handleDownload ( ) { $ path = explode ( '/' , str_replace ( '/get' , '' , $ this -> request -> path ( ) ) ) ; $ key = end ( $ path ) ; if ( ! $ fileMeta = $ this -> cache -> get ( $ key ) ) { return $ this -> response -> send ( '404 upload not found.' , HttpResponse :: HTTP_NOT_FOUND ) ; } $ resource = $ fileMeta [ 'file_path' ] ?? null ; $ fileName = $ fileMeta [ 'name' ] ?? null ; if ( ! $ resource || ! file_exists ( $ resource ) ) { return $ this -> response -> send ( '404 upload not found.' , HttpResponse :: HTTP_NOT_FOUND ) ; } return $ this -> response -> download ( $ resource , $ fileName ) ; }
Handle Download request.

@return BinaryFileResponse|HttpResponse
Handle Download request .