|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54951 Temporary Files Are NOT Deleted
Submitted: 2011-05-29 18:08 UTC Modified: 2015-03-30 21:26 UTC
Avg. Score:3.7 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: miqrogroove at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.3.6 OS: Windows 2003
Private report: No CVE-ID: None
 [2011-05-29 18:08 UTC] miqrogroove at gmail dot com

"The file will be deleted from the temporary directory at the end of the request 
if it has not been moved away or renamed."

This is blatantly wrong.  PHP does not automatically remove any uploaded .tmp file 
from the temporary directory.

PHP 5.3.1 and 5.3.6 were tested specifically to confirm this behavior is not as 

Test script:
test.php, placed on website:
<form method="post" enctype="multipart/form-data">
 <input name="myfile" type="file" />
 <input type="submit" />

Expected result:
While monitoring the temporary directory, essentially nothing should happen.

Actual result:
Each click of the Submit button causes an additional file to be added to the 
temporary directory.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-30 05:18 UTC]
Then that is a Windows-specific issue. They are removed everywhere else.
 [2015-03-30 21:26 UTC]
-Status: Open +Status: Not a bug
 [2015-03-30 21:26 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

Even on Windows uploaded files are supposed to be removed at the of
the request. I just verified with PHP 5.4.19 on Windows 7.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Mar 22 06:03:37 2023 UTC