I may be wrong about this as I have little experience dealing with binary
files.  But I do not blieve that Content-Type: application/x acts like a
universial content type.  It seems to me that you're going to have to build
in a conditional that sets the appropriate Content-Type: based on the file
being displayed.  So the file is a GIF then the header should read
Content-Type: image/gif


----- Original Message -----
From: "Félix García Renedo" <[EMAIL PROTECTED]>
Sent: Tuesday, October 15, 2002 11:12 AM
Subject: [PHP] show a file

    I have to show a file pdf in a browser but its name in the filesystem is
something like "name_file.file" and the file is word, pdf, gif, etc

I tried to do:

          $url = 'http://domain.org/path/to/file/';
         $file = "name_file.file";

   header('Content-Type: application/x');

    header('Content-Disposition: attachment;  filename=' . $file ) ;
     header("Content-Transfer-Encoding: binary");

  $size = filesize($url . $file);
  header('Content-length: ' . $size ) ;

    @readfile($url . $file);

It doesn't work. But I read that it should work.

    How could do that?

Thanks in advance

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to