sharapeco/file-download

Make downloads for files in PHP

v1.0.0 2019-09-17 01:47 UTC

This package is auto-updated.

Last update: 2024-04-17 11:43:47 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');