Upload picture and server permissions 660?

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
Perfidus
Forum Contributor
Posts: 114
Joined: Sun Nov 02, 2003 9:54 pm

Upload picture and server permissions 660?

Post by Perfidus »

Hi!
I'm using this simple code to upload a picture to a directory in server, the problem I have is that the picture permissions when uploaded are not 664 but 660, it means it can be read by the public.
The directory is 777, so everything is ok, but why the picture is unreadable by defect and how can I change it?

Code: Select all

if(isset($image))
{
$target_path = "images/";
//$target_path = $target_path . basename( $_FILES['image']['name']); 
$_FILES['image']['tmp_name'];
$newname=$ref.".jpg";
$target_pathandname = $target_path.$newname; 
if(move_uploaded_file($_FILES['image']['tmp_name'], $target_pathandname)) {
     echo "*** ok";
} else{
     echo "***";
} }else{
     echo "*** No ha subido";
}
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Re: Upload picture and server permissions 660?

Post by bokehman »

Code: Select all

if(isset($image))
{
$target_path = "images/";
//$target_path = $target_path . basename( $_FILES['image']['name']); 
$_FILES['image']['tmp_name'];
$newname=$ref.".jpg";
$target_pathandname = $target_path.$newname; 
if(move_uploaded_file($_FILES['image']['tmp_name'], $target_pathandname)) {
     chmod($target_pathandname, 644);
     echo "*** ok";
} else{
     echo "***";
} }else{
     echo "*** No ha subido";
}
Post Reply