bullet89 bullet89 - 21 days ago 5
PHP Question

change permission for a file created using tempnam() from 600 to 644

How to change the permission of a file that was created by using

tempnam()
function in php to 0644?

I created some temporary file in
/tmp
directory using
tempnam()
and rename that file and changed the location of the file using
rename()


The renamed file has also permission
0600
, I need to change that permission to
0644
for download which was after loading of the webpage.

I tried changing that files permission to
0644
manually, but once the page was refreshed the permission changed to
0600
.

Dez Dez
Answer
chmod($file, 0644);

Check PHP documentation.