php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7475 Temporary file leak when zero-byte files are uploaded
Submitted: 2000-10-26 00:30 UTC Modified: 2000-10-30 10:34 UTC
From: jr-php at quo dot to Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.3pl1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 - 36 = ?
Subscribe to this entry?

 
 [2000-10-26 00:30 UTC] jr-php at quo dot to
If "FILE1" is a posted file and it is zero bytes in length, the following code will die with a "Failed - none" message:

$tmpfile = $HTTP_POST_FILES["FILE1"]["tmp_name"];
if (!is_uploaded_file($tmpfile)) {
	die ("Failed - " . $tmpfile);
}

Not only does it fail, it leaves a zero-byte "php" temporary file behind in /tmp.

But if the file is non-zero in length, it does not fail, and the temporary file is automatically deleted at exit.

I can reproduce this with IE 4.01sp1, IE 5.5, and Netscape 4.75. My HTML which calls the upload script looks like this:

<form method="POST" action="/doupload.php" ENCTYPE="multipart/form-data">
<input type=file name="FILE1" size=60>
<input type=submit value="Upload File">
</form>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-30 10:34 UTC] stas@php.net
Should be fixed in CVS. Please reopen if stil happens.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Sep 21 17:01:23 2020 UTC