[SOLVED] PHP 4 Image Uploads

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

[SOLVED] PHP 4 Image Uploads

Post 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
Last edited by mikeeeeeeey on Fri Mar 02, 2007 3:54 am, edited 1 time in total.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

It'll be permissions on the images/news/ directory I expect.
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

Post 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/ :?
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm wondering, how are you setting $image?
Post Reply