Could someone help me with my image uploading script which is uploading files with chmod 600 Here is the code move_uploaded_file($_FILES['attached']['tmp_name'], $att_path."/".$uniq.".".$ext ); chmod( "$att_path." . basename( $_FILES['attached']['tmp_name']),0644); I've added the second line but it doesnt work for some reason and images are still being uploaded as 600.
Have you tried: chmod($att_path."/".$uniq.".".$ext, 0755); PHP: Replace 0755 with whatever permissions if you don't like them. Jay
I am quite sure some hosts don't allow the CHMOD function for security (I may be wrong). If worse comes to worse, simply contact your host and have them change the CHMOD on uploaded files.
You have to remember user/group permissions. For example: A typical cPanel host with user charlie: Files created are chown'd and chgrp'd (owned and grouped respectively) charlie. However, apache runs as NOBODY, therefore CHMOD function won't work on FTP'd or cPanel created files (nobody can't edit charlie's files unless they are CHMOD 0777). They will only work on files that were created by PHP (file uploads, fopen, etc). If you run with Mod_SUPHP or Mod_PHPSUExec you would not have this problem, as Apache runs as the user, and 0777 permissions are not required for editing and uploads. This could be why you are saying this Jay