Page 1 of 1

[SOLVED] PHP 4 Image Uploads

Posted: Fri Mar 02, 2007 3:27 am
by mikeeeeeeey
Yo guys, having a bit of a nightmare.

One of my client's hosting companies I've just found to be running PHP 4 instead of 5 (which I've built the whole website in). I've managed to sort out the mail function, but the image upload is still failing.

I'm getting a Permissions issue error message, but I've changed all the permissions on the folder and the script itself to 0777.

Code: Select all

Warning: move_uploaded_file(images/news/HIPs.jpg): failed to open stream: Permission denied in /vhost/vhost5/c/o/n/converge-it.net/www/newsEdit.php on line 92

Warning: move_uploaded_file(): Unable to move '/tmp/phpf4LzU1' to 'images/news/HIPs.jpg' in /vhost/vhost5/c/o/n/converge-it.net/www/newsEdit.php on line 92
Could not copy HIPs.jpg

Here's the code I'm using at the momemnt:

Code: Select all

if ($image != NULL){
  move_uploaded_file($_FILES['image']['tmp_name'], "images/news/" . $image)
  or die("Could not copy " . $image . "<br/>");
}
If anyone could help, it would be much appreciated.

Thanks in advance :D

Posted: Fri Mar 02, 2007 3:46 am
by onion2k
It'll be permissions on the images/news/ directory I expect.

Posted: Fri Mar 02, 2007 3:47 am
by mikeeeeeeey
onion2k wrote:It'll be permissions on the images/news/ directory I expect.
I know it looks that way, but as I said, I've changed them all to 777 on the images folder. I checked after and this also got changed on images/news/ :?

Posted: Fri Mar 02, 2007 3:54 am
by mikeeeeeeey
urgghhh!!

onion, correction, you are so right.

just found out they've reset all the permissions since I last changed them. so now it works fine.

I'll have to thank them for letting me know :roll:

thanks man

Posted: Fri Mar 02, 2007 8:03 am
by feyd
I'm wondering, how are you setting $image?