1 Reply Latest reply on Mar 19, 2008 12:16 AM by nihao_paul

    Flex 3 download file problem

      Hi,

      My Flex 3 app uses a php script to download a file, it seems like it works with the file appearing on the desktop but the file is only 1 byte long. The php and Flex are running on Leopard, here's the php (I think it's from some Adobe sample code), any help appreciated.
      -----------------
      $query = "SELECT * FROM uploads WHERE upload_id = $id";
      $result = mysql_query($query, $conn);
      if(mysql_num_rows($result))
      {
      $row = mysql_fetch_assoc($result);
      $fn = $row["upload_filename"];
      $ft = $row["upload_filetype"];
      $fs = $row["upload_filesize"];

      $the_file = '../../uploads/' . $id;

      header("Content-Type:$ft\n");
      header("Content-disposition:
      attachment;filename=\"$fn\"\n");
      header("Content-Length: $fs\n");
      readfile($the_file);
      }
      -----------------
      Thanks,

      Paul