Adam Posted May 18, 2009 Share Posted May 18, 2009 I've recently created a small CMS app for a client to upload new products to his website. This includes an image that is resized and saved on the web server. However the permissions set on the file do not allow me to modify them at all from within an FTP client. When the image is resized I'm adding the chmod function to try and stop this but it's not working, I'm currently using: chmod(__img_loc__, 0777); Could anybody think why? Thanks for any help! Adam Quote Link to comment https://forums.phpfreaks.com/topic/158632-unable-to-modify-file-through-an-ftp-client/ Share on other sites More sharing options...
waynew Posted May 19, 2009 Share Posted May 19, 2009 I'm not too sure. But isn't it a bad idea to messing around with uploaded images that are probably referenced to in the database, providing you're talking about images that are after being uploaded with products? Quote Link to comment https://forums.phpfreaks.com/topic/158632-unable-to-modify-file-through-an-ftp-client/#findComment-836832 Share on other sites More sharing options...
Daniel0 Posted May 19, 2009 Share Posted May 19, 2009 Are you sure you are the owner of the file. Only the owner can change a file's permissions. Quote Link to comment https://forums.phpfreaks.com/topic/158632-unable-to-modify-file-through-an-ftp-client/#findComment-836961 Share on other sites More sharing options...
Adam Posted May 19, 2009 Author Share Posted May 19, 2009 I'm not totally sure how to phrase it but I think the PHP script is the owner? I don't how to change the file permissions to enable the FTP user to own the file though... Oh and waynewex the current images I'm playing with are just some test products, and the file path is built up from several fields in the database. Occasionally the guy who uses the little app makes mistakes with the image and have it uploaded somewhere else, or name it wrongly or something and asks me to just correct it. I want to be able to just open my FTP client and quickly rename, delete or move the image without getting a permission denied message. If you follow me? Do you think the easiest / best solution right now be to just rewrite the code to use FTP to upload the image? Thanks Adam Quote Link to comment https://forums.phpfreaks.com/topic/158632-unable-to-modify-file-through-an-ftp-client/#findComment-837016 Share on other sites More sharing options...
xylex Posted May 20, 2009 Share Posted May 20, 2009 Is this a shared server? If it is, the best solution would be to use suexec/suphp so that the uploaded files are owned by the ftp/account user. If the host won't do that, find a different host. Otherwise your site is vulnerable to a number of different hacks. If it's your own box, I would probably just add the ftp user to the php/apache user's group, and chmod the file 664 in the script. Quote Link to comment https://forums.phpfreaks.com/topic/158632-unable-to-modify-file-through-an-ftp-client/#findComment-837892 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.