/    Sign up×
Community /Pin to ProfileBookmark

change chmod for overwriting files on remote server

I have set up a folder for uploading images.I want to overwrite some of the images,as and when required.I changed the permissions of the folder on my host to 777 using WS-FTP and then using chmod.
The permission reverts back to 644 and the file does not get overwritten.Is there any PHP script to use to change the permissions?Can anyone tell me what to do.???If I try to change it again,then I am getting ‘550’ “permission denied” .Is there some restriction put by the administrator?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@scragarJan 25.2005 — I don't know about your admin but it';s impossible for PHP to realisticly edit permissions, true you could create a new text file fill in all the content of the old and and delete the old one, but that's not very safe(indead anything but!)
Copy linkTweet thisAlerts:
@ashokvasauthorJan 25.2005 — Thanks for responding.

I have seen sites where users can upload their pictures and later on they can upload new pictures and this overwrites the old picture.How is that done??

Also there is a chmod function which changes the permissions for the folder/files??Have you come across it??
Copy linkTweet thisAlerts:
@NogDogJan 25.2005 — chmod will only work if either (a) you are the owner of the file being changed, or (b) you are the root "superuser". When you run a PHP page via the webserver, the process is normally run under its own user ID, [i]not[/i] your user ID.

One way to deal with this would be to have your sysadmin add you to the same user group that the PHP user belongs to. Then set the permissions on the directory and any files to include read/write for the owner and the group: 664. You may want to change your umask to 002 as well, to make the default permissions include write for the group. (Again, see your sysadmin to help set this up.)
Copy linkTweet thisAlerts:
@ashokvasauthorJan 26.2005 — Dear NogDog,

Thanks but I have already tried setting the directory to 777 abd it once again reverts back to 644.I want to keep the settings at 777 or 664 so that any user can upload his pictures (on my site) and also overwrite them if he so desires.

By the way what does 'umask' do?

Hope I am able to convey my needs .

Regards

Ashokvas
Copy linkTweet thisAlerts:
@NogDogJan 26.2005 — umask tells the OS what default permissions should be assigned to newly created files. (Note: I'm not really an expert on this sort of stuff - I would talk with a sysadmin type to help me set this kind of stuff up if I were in your place. I just know enough to be dangerous. ? )
×

Success!

Help @ashokvas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...