ID:               32644
 User updated by:  tck at tcknetwork dot com
 Reported By:      tck at tcknetwork dot com
-Status:           Feedback
+Status:           Closed
 Bug Type:         Filesystem function related
 Operating System: WinXP(SP2)
 PHP Version:      5.0.4
 New Comment:

Well, I tried with my apache configured with its root at C:\Server
instead of D:\Server and it works fine there.
I suppose this is because in Windows if we want to change the drive we
have first to type
$>D:[enter] 
$>cd \Server\

Then I suppose it is a apache-related bug. I will report it to them...


Previous Comments:
------------------------------------------------------------------------

[2005-04-11 02:03:06] [EMAIL PROTECTED]

And you are aware that Apache does an internal 'cwd /' ?
(changes working directory to root)


------------------------------------------------------------------------

[2005-04-10 22:45:31] tck at tcknetwork dot com

The next question will be probably "what if you dismiss the ../" ? The
answer is that it works properly :

move_uploaded_file($_FILES["myfile"]["tmp_name"],"data/demo.jpg");

move properly the file into D:\Web\test\data, but the problem still
remains if I have

move_uploaded_file($_FILES["myfile"]["tmp_name"],"../data/demo.jpg")

In fact the bug happen only if you go backward in the filesystem tree,
no matter how deep you are (I tried from
D:\Web\test\test\demo\up\up.php > D:\Web\test\test\demo\data but the
file went still into D:\data)

------------------------------------------------------------------------

[2005-04-10 22:35:21] tck at tcknetwork dot com

As recommended, I upgraded to the 5.1.0-dev snapshot (php5ts.dll &
php5apache2.dll) and deleted my php.ini to be sure there wouldn't be
any misconfigured option.
On top of that I edited my script like this (I added all warnings as
demanded and a little fix to avoid a warning message not related to the
bug) :

<?
 error_reporting(E_ALL); ini_set('display_errors', 1);
 if (count($_FILES)) {
  $f=$_FILES["myfile"]["tmp_name"];
  if (move_uploaded_file($f,"../data/demo.jpg")) echo "up";
 }
?>
<form enctype="multipart/form-data" method="post"
action="<?=$_SERVER["PHP_SELF"]; ?>">
 <input type="file" name="myfile"> <input type="submit"
value="upload">
</form>

I tried to run my script twice (like before) but the problem remains
exactely the same.
The hard disk root is still taken as the "current directory" instead of
the script's directory.
I'm nearly sure that the bug happened when I upgraded from 5.0.3 to
5.0.4.

Does this bug come from a "default include directory" or something like
that where the engine decide to go first ?
The most annoying is that once the file in D:\Data\demo.jpg exists, the
function works as expected...

------------------------------------------------------------------------

[2005-04-10 21:38:25] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Also add this to be first line in your script handling the upload:
error_reporting(E_ALL); ini_set('display_errors', 1);


------------------------------------------------------------------------

[2005-04-09 17:17:08] tck at tcknetwork dot com

This happens both if I use zend optimizer or not (I doubted it could be
a possible source of problems. Note as well that my Apache (2.0.53,
using php as a module) root is on D:\Server if it may help.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/32644

-- 
Edit this bug report at http://bugs.php.net/?id=32644&edit=1

Reply via email to