xy2z/file-render

Renders file in the browser from a non-public dir.

1.0.1 2017-12-17 14:55 UTC

This package is auto-updated.

Last update: 2024-10-29 04:11:11 UTC


README

Presents a file in the browser from a non-public dir.

The file will be downloaded if not presentable (eg. .dll, .exe etc.)

Requirements

  • PHP 7.0 or above
  • php_exif extension enabled (included in PHP)

Installation

Install the latest version with Composer.

$ composer require xy2z/file-render

Basic Usage

use xy2z\FileRender\FileRender;

$fr = new FileRender('/path/to/file.png');
$fr->render();

Force Download

$fr = new FileRender('/path/to/file.png');
$fr->force_download = true;
$fr->download_filename = 'renamed.png';
$fr->render();