|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37118 is_file returns false for uploaded file
Submitted: 2006-04-18 09:48 UTC Modified: 2006-06-28 01:00 UTC
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:4 (100.0%)
From: kimmo dot laine at zarga dot net Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.1.2 OS: Windows 2003 IIS 6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kimmo dot laine at zarga dot net
New email:
PHP Version: OS:


 [2006-04-18 09:48 UTC] kimmo dot laine at zarga dot net
Running IIS 6 on Windows 2003 server. 

After an update to the most recent version of php 5.1.2, for some reacon a function handling uploaded using is_file stopped working. is_file failed for existing files. I fixed it by changing is_file to file_exists, then it worked again. Prior to the update, in the older version, presumably it was 5.0.1, is_file worked just fine without problems.

Reproduce code:
echo 'is_file:' . (is_file($_FILES['myfile']['tmp_name']) ? 'true' : 'false');
echo 'file_exists:' . (file_exists($_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" />

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-22 17:42 UTC]
What do you get if you add var_dump($_FILES['myfile']['tmp_name']); to your code?
 [2006-04-24 06:18 UTC] kimmo dot laine at zarga dot net
adding var_dump($_FILES['myfile']['tmp_name']); to the code
echoes the following: 

string(27) "C:\WINDOWS\TEMP\phpAC2A.tmp"
 [2006-06-20 15:09 UTC]
Please try using this CVS snapshot:
For Windows:

 [2006-06-28 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".
 [2006-08-02 16:04 UTC] fartal at lanbyte dot com
Same bug found in Windows 2000 server IIS and PHP Version 4.3.11
 [2009-02-17 10:14 UTC] michal dot kocarek at brainbox dot cz
I experience this bug as well (PHP 5.2.8 running on IIS 6.0 on Windows 2003 Server).

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

I can say that before we upgraded from PHP 5.1.x to PHP 5.2.8, this bug
was not there.

I posted same message to Bug #38308.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Feb 29 05:01:26 2020 UTC