PHP move_uploaded_file help :(
Author
Discussion

docevi1

Original Poster:

10,430 posts

278 months

Tuesday 26th July 2005
quotequote all
I can't figure this, I've been fighting it all day and I can't find a solution.

I have a small script which is to upload some files using a form, make a folder based on settings in the form & then copy it to said folder. I've got the script to do everything except move the file where I get the error:

[i]Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 565 is not allowed to access /home/virtual/site59/fst/var/www/html/techTipsImages/2005-1-72 owned by uid 48 in /home/virtual/site59/fst/var/www/html/adminSection/pages/marlin/techTips.php[/i]

I've just made the folder 2005-1-72 and chmod'd it 777 and it's correctly formed (checked with FTP access) but I'm blowed if I can get the sodding thing to work.

The script in question is:
-----
$uploadpath = $_SERVER['DOCUMENT_ROOT']."/".$imagesDirectory.$year."-".$month."-".$aID."/".$image.".jpg";

//$uploadpath = "/var/www/html/".$imagesDirectory.$year."-".$month."-".$aID."/".$image.".jpg";
//$uploadpath = "./../".$imagesDirectory.$year."-".$month."-".$aID."/".$image.".jpg";

echo $uploadpath;

if(is_uploaded_file( $_FILES[$image]['tmp_name']))
if(move_uploaded_file($_FILES[$image]['tmp_name'], $uploadpath))
echo "yes";
----
is this right and there is something afoot with the server? I had similar errors when I was getting the mkdir to work (I was giving it an absolute not relative root), but nothing I do gets this to work :(.

Help, please. I'm going crazy here.

Plotloss

67,280 posts

300 months

Tuesday 26th July 2005
quotequote all
PHP on the target machine is running in safe mode which I am assuming from that error message means that you cannot move files around in the file system under those restrictions.

Do you have a test PHP implementation locally that you can turn safe mode on and off in in order to replicate the error?

Programmers rule: If it doesnt work by lunchtime, work on something else.

docevi1

Original Poster:

10,430 posts

278 months

Tuesday 26th July 2005
quotequote all
thats what I was guessing, but I had the same trouble with mkdir and I managed to fix that by changing the path etc.

Just wondering if I had done something silly before contacting Tech Support for help (and feeling stupid again).

JamieBeeston

9,294 posts

295 months

Tuesday 26th July 2005
quotequote all
docevi1 said:
thats what I was guessing, but I had the same trouble with mkdir and I managed to fix that by changing the path etc.

Just wondering if I had done something silly before contacting Tech Support for help (and feeling stupid again).


Safety First.

I think support are the best bet

J

d-man

1,019 posts

275 months

Tuesday 26th July 2005
quotequote all
I've had the same problem with directories created by PHP on Register1's VDS. The ability to create directories dynamically wasn't important to me so I just did it by hand, would be nice to know when you find the answer though.

JamieBeeston

9,294 posts

295 months

Tuesday 26th July 2005
quotequote all
d-man said:
I've had the same problem with directories created by PHP on Register1's VDS. The ability to create directories dynamically wasn't important to me so I just did it by hand, would be nice to know when you find the answer though.


I'll drop you the answer via your Profile.

Suffice it to say, its done for security to stop peoples accounts being hacked and rogue data being uploaded and executed.

J

docevi1

Original Poster:

10,430 posts

278 months

Tuesday 26th July 2005
quotequote all
JamieBeeston said:
Safety First.

I think support are the best bet

J
You were right, they were

Thanks Jamie (just wanted to make sure it wasn't an issue with my coding before contacting Support).