0 Replies Latest reply on May 16, 2007 7:14 AM by GKRichie

    download file through PHP

    GKRichie
      I have a PHP script that extracts data from a database and prompts the user to save the file (through the browser).
      This is how it's done...

      $fileName = 'dynamically-generated-file.xls';
      header("Content-type: application/vnd.ms-excel");
      header("Content-Disposition: attachment; filename=$fileName");

      For security reasons, I am not saving the file on the server and the file must be done through this script as it checks to make sure that the user belongs to the correct group before downloading.

      Through flex I am calling the script and POST the username and password. However, I cannot download the file. When I access it through an HTML script, It works fine. How do I get a the browser to show a 'save file' box without me having to open a new window?
      Any thoughts or suggestions would be appreciated.
      Thanks
      -Rich