wiki/content/20201116142105-tempnam.md

414 B

id title
030ab7e7-9b0f-4be2-8a62-28b82640ddb7 tempnam()

Description

Like the PHP tempnam() function this method creates a file with a unique name in the given directory.

Syntax

use Symfony\Component\Filesystem\Filesystem;

$fs = new Filesystem();

$fs->tempnam('/tmp', 'report_');         // '/tmp/report_Um3nlH'
$fs->tempnam('/tmp', 'report_', '.pdf'); // '/tmp/report_Um3nlH.pdf'