File upload problem!!

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
chrisw
Forum Newbie
Posts: 4
Joined: Tue Oct 25, 2005 11:23 pm

File upload problem!!

Post by chrisw »

Hi everyone!

I have a form that posts four images to a php script. I am trying to get this script to move the temp files to a more perminant directory so that I can use phpThumb to generate thumbnails from the images before they are saved to MYSQL. Anyway I've tried the following...

$tmp_path_image1=$_FILES['image1']['tmp_name'];

move_uploaded_file("$tmp_path_image1", "/store/image1.jpg");

This is just a test but my understanding is that this should save the file as test.jpg in the /store dir. I've created this dir on the root. When I run this I get the following error...

Warning: move_uploaded_file(): open_basedir restriction in effect. File(/store/image1.jpg) is not within the allowed path(s): (/home/httpd/vhosts/mysite.co.uk/httpdocs:/tmp)

Ok so I assume this is saying that I need to use the /tmp directory only as this is what is set in my $basedir setting so I change the /store to /tmp and the script runs ok without error. The problem is however that when I browse the /tmp dir I can't see the file!! I'm very confused. :(

Any help would be greatly appreciated.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

try using the full server path

i presume it is

/home/httpd/vhosts/mysite.co.uk/httpdocs/store/
chrisw
Forum Newbie
Posts: 4
Joined: Tue Oct 25, 2005 11:23 pm

Post by chrisw »

Thanks Pimptastic!!

That worked great. I'm a happy bunny again :D
Post Reply