WMV video file won't play after download via HTTP,
Error: file you are attempting to play has an extension that does not match the file format. I click yes to play it anyway, and it says the file is corrupt or wmp doesn't support the format.

 
 header("Content-Type: video/x-msvideo");
 header("Content-Disposition: attachment; filename=$filename");
 readfile("$folder/$filename");

The video file plays ok otherwise. And the save prompt has all the right info minus an icon. It has the filename and extension correct, and has the content type as: Windows Media (TM) Video File.

Same problem in all browsers.

    ok, it's not the code, because it works fine on my local webserver. There must be a different apache setting on my server.

      djbryson wrote:

      ok, it's not the code, because it works fine on my local webserver. There must be a different apache setting on my server.

      you can have a look here:
      MIME Type Settings for Windows Media Services
      http://support.microsoft.com/kb/288102

      Browser MIME Type Considerations
      Browser MIME types should be set automatically when Windows Media Player is installed.
      To change these settings manually, refer to your browser documentation to determine how to add the following settings:

      Extension MIME Type
      ASX video/x-ms-asf
      WMA audio/x-ms-wma
      WAX audio/x-ms-wax
      WMV video/x-ms-wmv
      WVX video/x-ms-wvx
      WM video/x-ms-wm
      WMX video/x-ms-wmx
      WMZ application/x-ms-wmz
      WMD application/x-ms-wmd

      What you could do, is have your program check the extension of the file
      and then insert the Content-Type value
      some thing like this:

      <?php
      
      //if extension of $filename is = '.xx1' then $content = 'yyyy/11111"
      //if extension of $filename is = '.xx2' then $content = 'yyyy/2222"
      
      header("Content-Type: ". $content );
      header("Content-Disposition: attachment; filename=$filename");
      readfile("$folder/$filename");
      
      ?>
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: public");
        header("Content-Description: File Transfer");
        header("Content-Type: application/force-download");
        header("Content-Disposition: attachment; filename=file.xxx");

        you must change Content-Type to

        header("Content-Type: application/force-download");
          Write a Reply...