Problems with permissions when using the tempnam () php function

1

I am creating a pdf in a temporary directory with the tempnam function As follows:

 $tmpfname=tempnam("/tmp","argprocesor");
file_put_contents($tmpfname.".rtf", $pdf);

exec("unoconv -f pdf ".$tmpfname.".rtf");

header("Pragma:");
header("Cache-control: private");
//header("Content-Type: text/rtf");
//header("Content-Type: application/vnd.oasis.opendocument.text");
header("Content-Disposition: attachment; filename=archivoTemporal.pdf");

To later be sent to an ftp with:

ftp_put($id,$directorio,$tmpfname,FTP_BINARY);

The problem is that the tempnam function does not allow me to send it, since when creating the temporary directory, it creates it with permissions 0666. Now try to change the permissions with:

chmod($tmpfname,0777);

But it does not change them when printing the permissions after putting this line of code equally variable $ tmpfname still has 0666 permissions so it will not let me send the file by ftp.

    
asked by Eduardo Jesus 15.08.2016 в 22:22
source

0 answers