PHP code example of gisostallenberg / file-serving
1. Go to this page and download the library: Download gisostallenberg/file-serving library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gisostallenberg / file-serving example snippets
GisoStallenberg\FileServing\FileServer;
$fileserver = new FileServer('../../serve-me/', 'serve-it/');
$fileserver->serve(); // will server http://example.com/serve-it/example.txt when ../serve-me/example.txt exists, gives a 404 otherwise
GisoStallenberg\FileServing\FileServer;
use Symfony\Component\HttpFoundation\Response;
$fileserver = new FileServer('../../serve-me/', 'serve-it/');
$response = $fileserver->getResponse(); // do not serve yet
if ($response->getStatusCode() === Response::HTTP_NOT_FOUND) {
$fileserver = new FileServer('../../serve-other-dir/', 'serve-it/'); // check another directory
$response = $fileserver->getResponse();
}
$response->send();
txt
RewriteRule .* file-serving.php [QSA,L]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.