Is it possible to create a .pdf file extension when using tempname? I need to send an e-mail with a file created using tempname. (I can send the file, but I need the .pdf extension)
$tempname = tempnam('', 'report_');
rename($tempname, $tempname .= '.pdf');
// now use the new filename as you wish
var_dump($tempname, is_file($tempname));
By default such files are created with the strictest level of privileges possible. Typically they're only readable by the current user. It may be necessary to make these files group-readable:
chmod($original, 0640);
Or even world-readable, although this is inadvisable:
chmod($original, 0644);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With