This one is proving a little tricky! I use php upload to move an image from PC to server. Trouble is when image uploaded it defaults CHMOD to 600 - meaning no-one can access it. I am using following code: $cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName); $file_dir = "/path/to/server/htdocs"; foreach($_FILES as $file_name => $file_array) { if (is_uploaded_file($file_array['tmp_name'])) { move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or die ("Couldn't copy"); } } chmod ('$file_dir/$file_array[name]', 0755); Of course I have replaced the actually $file_dir above to protect username but even though I have left the CHMOD until the end I receive error even though image uploads to server fine: Warning: chmod() [function.chmod]: No such file or directory in /path/to/server/htdocs/entry.php on line 14 Does anyone have any ideas? Thanks!
also uid is needed in their as well look at the php manual, works wonders.. cannot remember why it has been to long since I touched php but yeah.. maybe your path is wrong, you don't need the exact path from the top to it, just from where the script is run to the file, so that could be the other possible error.
I know the path is correct because the image is uploading fine - it's just the CHMOD that's the problem. I've also tried: chmod ('$file_array[name]', 0755); But this brings up the same error! Any ideas?? Thanks, CC