PHP code example of coercive / fileserve
1. Go to this page and download the library: Download coercive/fileserve 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/ */
coercive / fileserve example snippets
use Coercive\Utility\FileServe;
# Serve file
FileServe::output('/path/file.extension');
use Coercive\Utility\FileServe;
# V2
$serve = new FileServe('/path/file.extension');
# Send range
$serve->range();
# Serve file
$serve->serve();
# Send download
$serve->download();
# Get mime
$string = $serve->mimeType();
# Get filesize
$string = $serve->getSize();
# Enable / Disable header no cache options
$serve->enableCache()
$serve->disableCache()
# Enable / Disable header content disposition filename for html5 attr : <a download="filename">
$serve->enableFilename()
$serve->disableFilename()