PHP code example of pekkis / temporary-file-manager
1. Go to this page and download the library: Download pekkis/temporary-file-manager 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/ */
pekkis / temporary-file-manager example snippets
use Pekkis\TemporaryFileManager\TemporaryFileManager;
$fm = new TemporaryFileManager($someDirectoryPath);
// Add some bytes
$ret = $fm->add($someContent);
// or add a file and it gets copied
$ret2 = $fm->addFile($someFilePath);
// Either way, you get a path to the temporary file
var_dump($ret);
// And when all the manager references are destroyed, typically at the end of a request, the files are deleted too.
unset($fm);