Project

General

Profile

Automatically delete files after download

Added by Fa. e.stradis GmbH over 3 years ago

Hello there,

according to our business processes, we must automatically delete the files once they have been downloaded. I have seen in the file include/download.php that the possibility seems to be already provided.

class ext_Download extends ext_Action {

    // download file
    function execAction($dir, $item, $unlink=false) {

        // ...

        if( $unlink==true ) {
            unlink( utf8_decode($abs_item) );
        }

        ob_end_flush();
        ext_exit();

    }
}

But the only call in extplorer.php does not pass the "$unlink" parameter, so it well always be set to "false" by default.
// ...
// Here we allow *download* and *directory listing*, nothing more, nothing less
switch( $action ) {
    case 'download':
        require _EXT_PATH . "/include/download.php";
        ext_Download::execAction($dir, $item);
        exit;
    case 'list':
    default:
        list_dir($dir);
        break;
}
// ...

My questions about this:
  1. is the function still called elsewhere (e.g. dynamic JS)?
  2. is there a way to set the option globally in the configuration?

Best regards,
Michael S.
(Team Infrastructure)