sharapeco / file-download
Make downloads for files in PHP
v1.0.0
2019-09-17 01:47 UTC
Requires
- php: ^5.4.0 || ^7.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-01-17 13:19:56 UTC
README
- Make downloads from file
- Make downloads from content
- IE 9+ (ja), Safari 5+ (ja), Android 4.4+, Chrome, Firefox, Edge support
Usage
From file
$filePath = '/path/to/file'; $download = sharapeco\HTTP\FileDownload::initWithFile($filePath); $download->download('download-filename');
From content
$content = 'This is the content of the file'; $download = sharapeco\HTTP\FileDownload::initWithContent($content); $download->download('download-filename');
Show PDF in browser with filename
$filePath = '/path/to/pdf'; $download = sharapeco\HTTP\FileDownload::initWithFile($filePath); $download->showPDF('filename.pdf');