if(!move_uploaded_file($_FILES['file']['tmp_name'], $path)) {
  if (is_uploaded_file($_FILES['file']['tmp_name']))
   echo "file ok <br>";
  else
   echo "file nok <br>";
 }

1- when I turn the safe mode off, the move is OK

2- when I turn the safe mode on, the move is not OK, but the
is_uploaded_file in my code below returns OK.

3- I also tried to init $path with /tmp/mydestfile but it still does not
work.

You're checking of move_uploaded_file worked and then checking if it's an uploaded file. You should do it the other way around:


if (is_uploaded_file($_FILES['file']['tmp_name'])) {
  if (move_uploaded_file($_FILES['file']['tmp_name'], $path)) {
     echo 'File Ok<br/>';
  } else {
     echo 'File Not Ok<br/>';
  }
}


Basically your '$path' is not owned by the right user.

With safe-mode on you can't dynamically create paths (ie you can't place the file in a NEW directory that apache has created).

You can only place files in paths that are already there (ie created through FTP or ssh).

http://www.php.net/features.safe-mode

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to