PHP code example of cars24 / php-tmpfile

1. Go to this page and download the library: Download cars24/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/ */

    

cars24 / php-tmpfile example snippets



use mikehaertl\tmp\File;

$file = new File('some content', '.html');

// send to client for download
$file->send('home.html');

// 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;