php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38308 is_file and file_exists return false for uploaded file
Submitted: 2006-08-03 09:29 UTC Modified: 2006-08-25 01:00 UTC
Votes:10
Avg. Score:3.9 ± 1.0
Reproduced:9 of 9 (100.0%)
Same Version:5 (55.6%)
Same OS:3 (33.3%)
From: fartal at lanbyte dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.4.3 OS: windows 2000
Private report: No CVE-ID: None
 [2006-08-03 09:29 UTC] fartal at lanbyte dot com
Description:
------------
Hi.
After uploading a file, functions "is_file" and "file_exists" return false for the temp file

Probably related to "Bug #37118 :is_file returns false for uploaded file" but getting false also with file_exists

Just upgraded to PHP Version 4.4.2 on Windows 2000 server SP4 from 4.3.11 where I found the same error


Reproduce code:
---------------
<?php
echo 'is_file:' . (is_file($_FILES['myfile']['tmp_name']) ? 'true' :
'false');?><br><?
echo 'file_exists:' . (file_exists($_FILES['myfile']['tmp_name']) ?
'true' : 'false');?><br><?
echo 'is_uploaded_file:' . (is_uploaded_file($_FILES['myfile']['tmp_name']) ?
'true' : 'false');
 ?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>"
enctype="multipart/form-data" method="post">
<input type="file" name="myfile" />
<input type="submit" />
</form>

Expected result:
----------------
is_file:true
file_exists:true
is_uploaded_file:true

Actual result:
--------------
is_file:false
file_exists:false
is_uploaded_file:true

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-02-17 10:12 UTC] michal dot kocarek at brainbox dot cz
I experience this bug as well.

- file_exists returns false (error)
- is_uploaded file returns true (good)
- fopen(..., 'r') works as well as file_get_contents (good)

We have PHP 5.2.8 running on IIS 6.0 on Windows 2003 Server.

I can say that before we upgraded from PHP 5.1.x to PHP 5.2.8, this bug was not there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC