PHP 4.0 Bug #9790 Updated: File left in temp dir after POST
| From: | sniper@php.net | Date: | Fri, 16 Mar 2001 16:20:06 +0000 |
| Subject: | PHP 4.0 Bug #9790 Updated: File left in temp dir after POST | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-49079@lists.php.net to get a copy of this message | ||
ID: 9790
Updated by: sniper
Reported By: richard@openkast.com
Old-Status: Open
Status: Closed
Bug Type: Filesystem function related
Assigned To:
Comments:
Fixed in PHP 4.0.4pl1.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2001-03-16 11:00:32] richard@openkast.com
<!-- myform.php -->
<html>
<form action="dosubmit.php">
<input name=image1 type=file>
<input type=submit>
</form>
</html>
<!-- END myform.php -->
<!-- dosubmit.php -->
<?php
//
// Move the image to the given directory
//
moveImageFile("imageDir");
function moveImageFile($destDir)
{
$imageName1 = $GLOBALS["HTTP_POST_FILES"]["image1"]["name"];
if (!empty($imageName1))
{
$filename = "$destDir/$imageName1";
move_uploaded_file($GLOBALS["image1"], $filename);
chmod($filename, "420");
}
}
?>
<!-- END dosubmit.php -->
If the user specifies a file which exists on the local machine, all well and good (the file is put
into the imageDir directory and the temp file is removed from /var/tmp). However, if they either
specify a non-existent file, or leave the input field blank, then a temp php..... file (0 bytes in
size) is left in /var/tmp.
The documentation says that uploaded files should automatically be removed from the temp dir, but it
doesn't seem to be happening in this case.
I can't even remove the file manually using unlink because I can't get the temp file name.
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9790&edit=2