MasterKaos
Programmer
I've used PHP to handle file uploads of image files and write them to a directory that has permission 777:
The uploaded images are displayed alright by the browser, but i can't read them using FTP. Checking their permissions they are set to 600. Right clicking them and changing their permisions using WS FTP Pro does nothing.
So i tried using a PHP script to change the permissions:
But when i run the script i get the error:
"Warning: chmod(): Permission denied in /home/ausget/public_html/chmods.php on line 8"
I don't get it, if PHP created the files, why does it not have permission to chmod them? How can i chmod all the existing files so that i can use FTP to copy them? Oh and the path and stuff is correct because the script outputs the correct filenames.
----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
Code:
move_uploaded_file($_FILES['image']['tmp_name'], "../images/accomodation/".$image_id.$extension);
The uploaded images are displayed alright by the browser, but i can't read them using FTP. Checking their permissions they are set to 600. Right clicking them and changing their permisions using WS FTP Pro does nothing.
So i tried using a PHP script to change the permissions:
Code:
if ($handle = opendir('images/accomodation'))
{
while (false !== ($file = readdir($handle)))
{
echo "$file\n";
chmod ("images/accomodation/" . $file, 0766);
}
closedir($handle);
}
But when i run the script i get the error:
"Warning: chmod(): Permission denied in /home/ausget/public_html/chmods.php on line 8"
I don't get it, if PHP created the files, why does it not have permission to chmod them? How can i chmod all the existing files so that i can use FTP to copy them? Oh and the path and stuff is correct because the script outputs the correct filenames.
----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.