I have a query with the way apache is setting permissions to the uploaded file using the move_uploaded_file function.
My script tests if the file has been uploaded i.e.
<?php
$the_path= "_img/_products";
echo "Variables are:<br>
$userfile." ".$userfile_name." ".$userfile_size." ".$userfile_type."<br>";
if ($userfile=="none")
{
echo "Problem: no file uploaded";
exit;
}
if ($userfile_size==0)
{
echo "Problem: uploaded file is zero length";
exit;
}
$destination = $the_path . "/" .$userfile_name;
if (!move_uploaded_file($userfile, $destination));
{
echo "Problem: Could not move file into directory";
exit;
}
?>
if I use move_uploaded_file my script outputs "Problem: Could not move file into directory" but the file is uploaded to web server & apache 2.0.4 will assign permissions 0600 to the uploaded file.
However if I use copy instead of move_uploaded_file my script still outputs "Problem: Could not move file into directory" and again the file is uploaded to web server but apache 2.0.4 this time assign's permissions 0755 to the uploaded file.
Therefore the two questions are;
Why are the above the above functions returning false, yet the upload is successful?
Why are the uploaded file permissions different for each function?
Cheers
Synfield