Page 1 of 1

Upload picture and server permissions 660?

Posted: Sat Jul 02, 2005 1:21 pm
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";
}

Re: Upload picture and server permissions 660?

Posted: Sat Jul 02, 2005 5:08 pm
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";
}