|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9790 File left in temp dir after POST
Submitted: 2001-03-16 11:00 UTC Modified: 2001-03-16 11:20 UTC
From: richard at openkast dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.3 OS: Solaris 2.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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: richard at openkast dot com
New email:
PHP Version: OS:


 [2001-03-16 11:00 UTC] richard at openkast dot com
<!-- myform.php -->
<form action="dosubmit.php">
<input name=image1 type=file>
<input type=submit>
<!-- END myform.php -->

<!-- dosubmit.php -->

// Move the image to the given directory

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-16 11:20 UTC]
Fixed in PHP 4.0.4pl1. 


PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 03:03:45 2023 UTC