php.net |  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
Votes:4
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
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:
---------------
<?php
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" />
</form>

Expected result:
----------------
is_file:truefile_exists:true

Actual result:
--------------
is_file:falsefile_exists:true

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-22 17:42 UTC] tony2001@php.net
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] tony2001@php.net
Please try using this CVS snapshot:

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


 [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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 04:01:29 2024 UTC