1. Go to this page and download the library: Download mikehaertl/php-tmpfile 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/ */
mikehaertl / php-tmpfile example snippets
use mikehaertl\tmp\File;
$file = new File('some content', '.html');
// send to client for download
$file->send('home.html');
// ... with custom content type (autodetected otherwhise)
$file->send('home.html', 'application/pdf');
// ... for inline display (download dialog otherwhise)
$file->send('home.html', 'application/pdf', true);
// ... with custom headers
$file->send('home.html', 'application/pdf', true, [
'X-Header' => 'Example',
]);
// save to disk
$file->saveAs('/dir/test.html');
// Access file name and directory
echo $file->getFileName();
echo $file->getTempDir();
use mikehaertl\tmp\File;
$file = new File('some content', '.html');
$file->delete = false;
use mikehaertl\tmp\File;
File::$defaultHeader['X-Header'] = 'My Default';
$file = new File('some content', '.html');
$file->send('home.html');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.