title: header("Content-Type: application/zip") and header("Content-Disposition: attachment; filename=$fileName") not working in wordpress?
body: <p><a href="https://i.stack.imgur.com/TinYQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TinYQ.png" alt="enter image description here"></a>The above two function not working in wordpress. I want to download file and i am running wordpress in xampp also i have tried it in another online server with wordpress framework still not working.</p>
  
  <p>but this is working in another online server where i have not used wordpress framework.</p>
  
  <p>Is there is problem with wordpress using the above two function?</p>
  
  <p>(below code just take get request which is the path to the file to be downloaded from the server and after validating token the path is given from database)</p>
  
  <pre><code>&lt;?php 
  ini_set('display_errors', -1 );
  require('wp-blog-header.php');
  require('wp-config.php');
  $token = ($_GET["token"]);
  $platform = ($_GET["platform"]);
  $resolution = ($_GET["resolution"]);
  $assetName =($_GET["assetName"]);
  $currentTime = date("ymdHi" , time());
  if($wpdb-&gt;query("SELECT * FROM wp_token_table WHERE token='$token'")){
      $result = $wpdb-&gt;get_results("SELECT (path) FROM wp_path_table WHERE os='$platform' AND res = '$resolution' AND bundle_name= '$assetName'");
      if($result){
      $path = $result[0]-&gt;path;
      $fileName = basename($assetName);
      $filePath = $path;
          if(!empty($fileName) &amp;&amp; file_exists($filePath)){
              header("Cache-Control: public");  
              header("Content-Description: File Transfer");
              header("Content-Type: application/zip");
              header("Content-Length:".filesize($filePath));
              header("Content-Disposition: attachment; filename=$fileName");
              header("Content-Transfer-Encoding: binary");   
              readfile($filePath);        
              exit;
          }
  
      }
  }else echo "false";
  
  ?&gt;
  </code></pre>