mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-26 23:07:59 +01:00
f87b29d064
Laravel 5 added several new helper functions, including: - `view()` - `response()` - `redirect()` - `config()` - `abort()` Review the [helpers][1] documentation for more details. [1]: https://laravel.com/docs/5.0/helpers
30 lines
875 B
PHP
30 lines
875 B
PHP
<?php
|
|
|
|
/**
|
|
* File.
|
|
*
|
|
* Note: Remember to remove the "File" alias in APP_DIR/config/application.php
|
|
*
|
|
* @author Phill Sparks <me@phills.me.uk>
|
|
*/
|
|
class File extends \Illuminate\Support\Facades\File
|
|
{
|
|
public static function inline($path, $mime, $name = null)
|
|
{
|
|
if (is_null($name)) {
|
|
$name = basename($path);
|
|
}
|
|
|
|
$response = response(static::get($path));
|
|
|
|
$response->header('Content-Type', $mime);
|
|
$response->header('Content-Disposition', 'inline; filename="'.$name.'"');
|
|
$response->header('Content-Transfer-Encoding', 'binary');
|
|
$response->header('Expires', 0);
|
|
$response->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
|
|
$response->header('Pragma', 'public');
|
|
$response->header('Content-Length', filesize($path));
|
|
|
|
return $response;
|
|
}
|
|
}
|