PHP move_uploaded_file help :(
Discussion
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.
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.
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.
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 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 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
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff



