Page 1 of 1

File upload problem!!

Posted: Tue Nov 22, 2005 10:17 am
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.

Posted: Tue Nov 22, 2005 10:40 am
by JayBird
try using the full server path

i presume it is

/home/httpd/vhosts/mysite.co.uk/httpdocs/store/

Posted: Tue Nov 22, 2005 11:08 am
by chrisw
Thanks Pimptastic!!

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