title: How to write Some Data in CSV file in Magento?
body: <p>I am trying print some shipment details as a CSV file and I am almost done in implementing this but it does not gives the the option for downloading.It automatically create the file and save it in the  directory mentioned.</p>
  
  <p>I think I am missing _prepareDownloadResponse() function but how do I implement this. </p>
  
  <p>I am using this code -></p>
  
  <pre><code>$file_path = 'sample_shipment.csv';
  $mage_csv = new Varien_File_Csv();
  $mage_csv-&gt;saveData($file_path, $content); 
  </code></pre>
  
  <p>Edit:
  All this code is in my indexcontroller.php 
  full code in indexcontroller.php -></p>
  
  <pre><code>class Company_Manifestupload_IndexController extends Mage_Adminhtml_Controller_Action
  {        
  public function indexAction() {
      echo 'Manifestupload Index!';
  }
  public function bluedartmanifestuploadAction() {
      $request = $this-&gt;getRequest();
      $shipmentIds = $request-&gt;getPost('shipment_ids', array());
      $file_path = 'manifest_upload_'.Mage::getSingleton('core/date')-&gt;date('d-m-Y_H-i-s').'_csv.csv';
      $mage_csv = new Varien_File_Csv();
      $shipment_csv=array();
  
              /*  Putting data in $shipment_csv[] */
              $mage_csv-&gt;saveData($file_path, $shipment_csv);
              }
  </code></pre>