FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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.
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.
Related topics
[tutor] How to protect images without htaccess using PHP
Phoenix free PHP scripts
Includ Images using PHP.
php script help!
Simple PHP script not working
Preventing bad PHP script calls
array check box on php script using $_POST
Need help with PHP script[RESOLVED]
I am trying to build a contact form using php and flash
Connected to another part of a php script.
Need a PHP script to downsample the image resolution
php script for Changing file permissions & owner
Image Copying
How do you Create a New Database using a php script?
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

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