ID: 40537
User updated by: stloukal at programator dot cz
Reported By: stloukal at programator dot cz
-Status: Feedback
+Status: Open
Bug Type: Filesystem function related
Operating System: FC4, 2.6.17
PHP Version: 5.2.1
New Comment:
Hello,
here is working code that demonstrates described bug. I append some
configuration that may be interesting for you.
Configuration:
Safe mode: off
$_SERVER[SCRIPT_FILENAME]:
/var/www/web/tuzemsko/krtek/admin/gallery_test.php
real path of the script:
/home/chroot/home/krtek/web/tuzemsko/www/admin/gallery_test.php
/var/www/web/tuzemsko/krtek is a symbolic link to
/home/chroot/home/krtek/web/tuzemsko/www/.
httpd.conf:
<Directory "/var/www/web/tuzemsko/krtek">
php_admin_value upload_tmp_dir /home/chroot/tmp/
php_admin_value open_basedir
/var/www/web/tuzemsko/krtek/:/home/chroot/tmp/:/home/chroot/home/krtek/web/
</Directory>
Directory /home/chroot/home/krtek/web/tuzemsko/tmp/ has 0777
permissions.
-------------------------------------------------------
Script:
<?php
// *************** UPLOAD FOTKY ***************
if ($_REQUEST['load_pic']) {
$name = 'galerie_'.$_FILES['soubor']['name'];
$path = '../../tmp/'.$name;
echo 'uploaded: '.$_FILES['soubor']['tmp_name'].' =
'.(int)file_exists($_FILES['soubor']['tmp_name']);
$res = move_uploaded_file($_FILES['soubor']['tmp_name'],
$path);
echo ' moved: '.$path.' = '.(int)file_exists($path);
}
// *************** UPLOAD FOTKY KONEC ***************
echo '
<form action="'.$_SERVER['PHP_SELF'].'" method="post"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="200000" />
<input type="file" name="soubor" />
<input type="submit" value="Save" />
<input type="hidden" name="load_pic" value="true" />
</form>
';
?>
Everything worked fine with 5.1.2 version.
Previous Comments:
------------------------------------------------------------------------
[2007-02-19 10:01:27] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2007-02-19 01:13:39] stloukal at programator dot cz
Description:
------------
Hello,
I have a problem with move_uploaded_file() function which doesn't move
the uploaded file. No errors or warnings are thrown, only false is
returned. Problem occurs only if target directory is RELATIVELY
addressed and it is named "tmp".
It seems, that this is the same problem:
http://bugs.php.net/bug.php?id=32456
Reproduce code:
---------------
$path = '../../tmp/'.$_FILES['soubor']['name']; // this is not the
system tmp directory
echo 'uploaded: '.$_FILES['soubor']['tmp_name'].' =
'.(int)file_exists($_FILES['soubor']['tmp_name']);
move_uploaded_file($_FILES['soubor']['tmp_name'], $path);
echo ' moved: '.$path.' = '.(int)file_exists($path);
Expected result:
----------------
uploaded: /home/chroot/tmp/phpcLIB4C = 1
moved: ../../tmp/galerie_2001_image001jpg.jpg = 1
Actual result:
--------------
uploaded: /home/chroot/tmp/phpcLIB4C = 1
moved: ../../tmp/galerie_2001_image001jpg.jpg = 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40537&edit=1