It sort of works now.

Here is my script so far:

$file = strtolower($_GET['filename']);
$file_split = explode(".", $file);
// The number of dots is counted in case a file has two or more dots
if($file_split[1] == 'pdf'){
header("Content-type: application/pdf");
} elseif($file_split[1] == 'xls') {
header ("Content-type: application/msexcel");
} elseif($file_split[1] == 'zip') {
header ("Content-type: application/zip");
header ("Content-Disposition: attachment; filename=$file" );



The problem is that with excel files it asks me if I want to download twice.
Also it opens in excel not IE. Sometimes PDFs open in IE sometimes the
don't.  What is wrong?

Also would I be better of collecting my stats then using a header to
re-direct to the right file(Rather than outputting it through a script)?

JJ Harrison

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
> On Thursday 04 July 2002 10:46, JJ Harrison wrote:
> > I can output the file using readfile(). But the problem is that it
> > to output the data in it's raw form. How can I get it to open in the
> > application?
> You _do_ want it to output the data in it's raw form. However it is your
> responsibility to output the correct headers beforehand so the browser
> what to do with the file. Search archives for "download" would/should
> up loads of articles on what form the headers should take.
> --
> Jason Wong -> Gremlins Associates ->
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> /*
> the butane lighter causes the pincushioning
> */

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to