Nov 25, 2009

Problem With Move_uploaded_file() - Permission denied?

free web hosting
Open Discussion & Free Web Hosting > Astahost > Hosted Members Support

Problem With Move_uploaded_file() - Permission denied?

Mordent
CODE
Warning: move_uploaded_file(images/profile/Mordent.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/mordent/public_html/withvalour/edit_image.php on line 42

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpOWVz7o' to 'images/profile/Mordent.jpg' in /home/mordent/public_html/withvalour/edit_image.php on line 42


Any ideas? The code seems fine, as it works a treat when I run it locally (on WAMPServer), but as soon as I try to run it on the server I get this horrid error. I'm guessing some weird permission problem that I have no idea how to get around.

Comment/Reply (w/o sign-up)

yordan
Just guessing. I would like to give read, write and execute permissons to everybody (user, group and others) to images/profile where the image has to be moved. Give 777 permissions first, then, if it works, try to raise the security level.

Comment/Reply (w/o sign-up)

Mordent
*facepalm*...for the love of...okay, so there's me thinking that some subdirectories inherited permissions. Works an absolute treat. '757' turned out to be the magic number there.

Cheers for pointing out the obvious. I have my little moments. wink.gif

Comment/Reply (w/o sign-up)

ethergeek
On my servers I usually just run apache as apache:apache and chown my public html directories to user:apache, chmod it to g+rxs and everything works fine.

Comment/Reply (w/o sign-up)

yordan
QUOTE
chmod it to g+rxs

Correct, that's also what I do, although the +s permissions could be sometimes dangerous.
However, if we are talking about public servers like astahost, the user can only use ftp clients, so he connot directly access the +s option. And the users which have ssh access here are probably jailed in a rsh sheel, i'm event not sure chmod is allowed in a restricted shell command line.

Comment/Reply (w/o sign-up)

FeedBacker
great guys
Problem With Move_uploaded_file()

I had this problem and 757 sure solved it. But do you know anyways to handle security with this kind of a breach

-reply by ulta coder

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)


See Also,

*SIMILAR VIDEOS*
Searching Video's for problem, move, uploaded, file, permission, denied,
advertisement



Problem With Move_uploaded_file() - Permission denied?

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com