Jump to content

Unable to modify file through an FTP client


Adam

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.