public static function delete_tempfile_from_draft($draftitemid, $filepath, $filename) {
        global $USER;
        $fs = get_file_storage();
        $user_context = context_user::instance($USER->id);
        if ($file = $fs->get_file($user_context->id, 'user', 'draft', $draftitemid, $filepath, $filename)) {
            $file->delete();
            return true;
        } else {
            return false;
        }
    }
public static function delete_tempfile_from_draft($draftitemid, $filepath, $filename) {
        global $USER;
        $fs = get_file_storage();
        $user_context = context_user::instance($USER->id);
        if ($file = $fs->get_file($user_context->id, 'user', 'draft', $draftitemid, $filepath, $filename)) {
            $file->delete();
            return true;
        } else {
            return false;
        }
    }
public static function delete_tempfile_from_draft ( $ draftitemid , $ filepath , $ filename ) { global $ USER ; $ fs = get_file_storage ( ) ; $ user_context = context_user :: instance ( $ USER -> id ) ; if ( $ file = $ fs -> get_file ( $ user_context -> id , 'user' , 'draft' , $ draftitemid , $ filepath , $ filename ) ) { $ file -> delete ( ) ; return true ; } else { return false ; } }
Delete a temp file from draft area

@param int $draftitemid
@param string $filepath
@param string $filename
@return bool
Delete a temp file from draft area