Re: show a file

From: Date: Tue, 15 Oct 2002 17:27:05 +0000
Subject: Re: show a file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120052@lists.php.net to get a copy of this message
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 -Kevin ----- Original Message ----- From: "Félix García Renedo" <felix@uva.es> To: "php" <php-general@lists.php.net> Sent: Tuesday, October 15, 2002 11:12 AM Subject: [PHP] show a file Hello, 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

« previous php.general (#120052) next »