Menu

#423 (ok 3.0.1) Temporary uploaded file not deleted

closed-accepted
PHP errors (22)
1
2008-10-22
2008-10-03
David Misc
No

phpMyAdmin 3.0.0
php 5.2.6
MySQL 5.0.67
Windows 2003 server
IIS 6

open_basedir is defined in php.ini

When trying to import a .sql file, it gets uploaded from my local drive and then the temporary file on the server is moved into the ./tmp folder inside the phpMyAdmin folder. The data is imported correctly.

The problem is that the temporary file inside the ./tmp folder does not get deleted after the import, even though there are sufficent permissions to delete it.

Near the bottom of import.php is the following code which deletes the temporary file that was created for the import.

// Cleanup temporary file
if ($file_to_unlink != '') {
unlink($file_to_unlink);
}

By inserting
fclose($file_to_unlink);

prior to the
unlink($file_to_unlink);

the temporary file in the phpMyAdmin/tmp folder will get deleted after the import.

Discussion

  • Marc Delisle

    Marc Delisle - 2008-10-03
    • labels: 438951 --> PHP errors
    • milestone: 869103 -->
     
  • Marc Delisle

    Marc Delisle - 2008-10-03

    Moved to patches.

     
  • Marc Delisle

    Marc Delisle - 2008-10-04
    • priority: 5 --> 1
    • assigned_to: nobody --> lem9
    • summary: import.php not deleting file in phpMyAdmin/tmp after import --> (ok 3.0.1) Temporary uploaded file not deleted
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2008-10-04

    Merged in subversion, thanks.

     
  • David Misc

    David Misc - 2008-10-08

    When I was submitting the fix I typed the wrong variable name in the fclose() line....it should have been $import_handle. Here are the correct lines copied straight from my working import.php file:

    if (!$error && $import_handle !== FALSE) {
    fclose($import_handle);
    }

    // Cleanup temporary file
    if ($file_to_unlink != '') {
    unlink($file_to_unlink);
    }

     
  • Marc Delisle

    Marc Delisle - 2008-10-09

    You're right and I had not tested before committing; just merged your latest fix, thanks.

     
  • Marc Delisle

    Marc Delisle - 2008-10-22
    • status: open-accepted --> closed-accepted
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.