/    Sign up×
Community /Pin to ProfileBookmark

File upload & chmod security question

I have an upload sytem in place so users can share there works. Problem is I can only get the upload to work if the directory is set to 777. I understand this can be a security issue and that most directories shold be set to 755. Is there a safe way of doing this? I tried to use PHP’s chmod function to chmod the directory to 777 for upload and back to 755 when the upload was complete but I kept getting a permissions error.

example:
Warning: chmod() [function.chmod]: Operation not permitted in yada yada yada.

I assume this is because my shared host doesn’t allow it? Tried searching for an answer but I came up with nothing helpful. Any ideas would be appreciated.

Thanks.

edit: I just realized I posted this in the Javascript forum :p sorry bout that… hopefully an admin can move it shortly.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @ToeBee 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,
)...