How specify a directory to file when downloading it

You can try this get the plugin directory:

$pluginPath = dirname(_____FILE_____); //plugin path

$pluginUrl = WP_PLUGIN_URL . '/pluginname/'; //plugin URL

good question

you just create one template in your plugin directory. there u use the above code.

you create one page and assign this template like this

add_filter( “template_include”, “yourpage” ) ;

function yourpage($single_template) {
global $post, $pagenow;

    if ($pagenow == 'download-template.php') {

        $single_template = dirname( __FILE__ ) . '/templates/download-template.php';
    }
    return $single_template;
}