File access permissions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mendingo
Forum Commoner
Posts: 28
Joined: Sun May 23, 2004 1:27 pm

File access permissions

Post 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?
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

chmod the file?

Probably...

Code: Select all

<?php
// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);
?>
User avatar
mendingo
Forum Commoner
Posts: 28
Joined: Sun May 23, 2004 1:27 pm

Post by mendingo »

Yeah, that does it. But I'm still puzzled as to why the default permissions are as they are.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

Safer that way - it forces you to decide the files needed permissions.
Post Reply