Page 1 of 1

File access permissions

Posted: Tue Jul 27, 2004 6:20 am
by mendingo
I'm uploading a jpg using POST, using GD to re-size it and storing it in another folder. This all works great except that the resultant file has permissions set where it is only readable by the owner, and so can not be viewed through the website, only ftp.

I've used a similar method before, and had no problems. Does anyone know why this might be happening, and what I can do to fix it?

Posted: Tue Jul 27, 2004 9:52 am
by Buddha443556
chmod the file?

Probably...

Code: Select all

<?php
// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);
?>

Posted: Tue Jul 27, 2004 10:39 am
by mendingo
Yeah, that does it. But I'm still puzzled as to why the default permissions are as they are.

Posted: Tue Jul 27, 2004 11:16 am
by Buddha443556
Safer that way - it forces you to decide the files needed permissions.