FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Uploading an Image using PHP script - RESOLVED

 


richard270384
Gday all,

I'm using a form on a web page and a PHP script to upload an image.

I'm getting some errors which I can probably figure out myself but is really frustrating me.

Here is the error:

Quote:
Warning: move_uploaded_file(/home/richard2/domains/articleplot.com/public_html/temp.gif) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/richard2/domains/articleplot.com/public_html/sources/pages/upload_avatar_save.php on line 17

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpdMJ7NJ' to '/home/richard2/domains/articleplot.com/public_html/temp.gif' in /home/richard2/domains/articleplot.com/public_html/sources/pages/upload_avatar_save.php on line 17


I've used the script on other servers without problems, so i'm wondering if frihost has some thing blocking the upload.

Any thoughts on this anybody?

edit: By the way, the path is right.

edit by rvec: Please use the edit button and keep it all in one post.


Last edited by richard270384 on Mon May 12, 2008 6:55 am; edited 1 time in total
mOrpheuS
richard270384 wrote:
Unable to move '/tmp/phpdMJ7NJ' to '/home/richard2/domains/articleplot.com/public_html/temp.gif'


You're trying to upload to the public_html folder - which most-likely is not chmodded to 777, which means php (running as a non-privileged user) will not be able to write to it.

Some hosts run apache as your user account, which allows php to write to folders with any permission in excess of 700.

Try creating a folder within public_html, changing its permissions to 777 and uploading to that folder instead.

p.s. - I'd not recommend changing the permissions of public_html itself to 777.
richard270384
Problem solved.

Thank you very much.
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.