title: custom file download wordpress admin plugin
body: <p>I want to add functionality to the wordpress plugin to download custom file.
  here is my code.</p>
  
  <pre><code>add_action('admin_menu','function_name');
  </code></pre>
  
  <p>and here is the download code.</p>
  
  <pre><code>header("Content-Disposition: attachment; filename=map.html");
  header("Content-Length: ".strlen($content));
  echo $content;
  exit;
  </code></pre>
  
  <p>But, I'm getting error.</p>
  
  <pre><code>[22-Feb-2015 00:00:00 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at /path/to/wp/wp-admin/includes/template.php:1877) in /path/to/wp/wp-content/plugins/plugin-name/lib/model.php on line 99
  </code></pre>
  
  <p>I'm making the request like this</p>
  
  <pre><code>http://www.website.com/wp-admin/admin.php?page=file-download&amp;fileid=10
  </code></pre>