dsartain Posted February 10, 2007 Share Posted February 10, 2007 I'm running an FC 6 server with PHP/mysql installed...I'm making a php page/script that will allow a user to upload images. The problem is that I want all images uploaded to be chmod 0644 so that no one else can delete them, I got that to work, but the user that uploads the images is apache. So I'm trying to do a chown (see below) to give the actual user ownership, but I get the error below... Warning: chown() [function.chown]: Unable to find uid for jjhughes:jjhughes in /var/www/html/jjhughes/gallery_up.php on line 70 if(is_uploaded_file($userfile_t)) { if(!move_uploaded_file($userfile_t, $upfile1)) { echo "Could not move files to destination directory"; exit; } if(!chmod($upfile1, 0644)) { echo "Could not modify file permissions"; } chown($upfile1, 'username'); $pic_link_t='http://www.the24hourshow.net/jjhughes/images/gallery/thumbnails/'.$userfile_t_name; echo "File uploaded successfully! <br />"; } else { echo "Possible file upload attack Filename: ".$userfile_t_name; exit; } Any ideas on how to work this out...other than chmod 0777??? Quote Link to comment Share on other sites More sharing options...
severndigital Posted February 10, 2007 Share Posted February 10, 2007 the error you are getting is because the user doesn't exits on the *nix machine. my simple work around would be to chmod the file so that no one can delete it. then when the user wishes to delete it, chmod it back to 777 and allow deletion. chris Quote Link to comment Share on other sites More sharing options...
dsartain Posted February 10, 2007 Author Share Posted February 10, 2007 but the user does exist on the machine...I just checked the passwd file to make sure...but I guess I could always put a delete button under the pic (inside some sort of control panel) so when she wanted to delete it she would just do it from there, and then apache would end up deleting it anyway.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.