Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

downloading files

0 views
Skip to first unread message

Sindre Hiåsen

unread,
Feb 3, 2004, 6:47:42 AM2/3/04
to
Hi,

Case: user select a file from a list and push download.
Then I tries to force a download dialog box to open for the user to get
the opportunity to save or open.
What I have tried is ( the file is an pdf-file)
the path is the full path.

header ("Content-Type: application/pdf");
header("Content-Disposition: atachment; filename=".$path);
readfile($path);

What happens. the file get printet out to the screen in binary or
something.

Someone, what is wrong?

Sindre

--
Sender med M2, Operas revolusjonerende e-postprogram: http://www.opera.com/

Marcel

unread,
Feb 3, 2004, 8:22:09 AM2/3/04
to

"Sindre Hiåsen" <paa...@ifi.uio.no> schreef in bericht
news:opr2slps...@news.online.no...

Instead of supplying a full path just do filename=document.pdf and a
download window will appear proposing the file to be saved somewhere as
document.pdf


Sindre Hiåsen

unread,
Feb 3, 2004, 3:30:22 PM2/3/04
to

> Instead of supplying a full path just do filename=document.pdf and a
> download window will appear proposing the file to be saved somewhere as
> document.pdf

Ok, I have tried only the filename. Nothing at all happens.
Her is more code

$fileName= $fileName .".pdf";
echo ("filename =$fileName");
if(is_file($fileName))-> true
{
echo("test");
$filesize = filesize($fileName);
echo ("filesize = $fileSize"); //filesize = nothing
}
echo ("filesize = $fileSize");


header ("Content-Type: application/pdf");

header("Content-Disposition: atachment; filename=".$fileName);
readfile($fileName);


anyone. ?

(I have tried it in both opera and explorer )

Sindre

Marcel

unread,
Feb 4, 2004, 4:07:00 AM2/4/04
to

"Sindre Hiåsen" <paa...@ifi.uio.no> schreef in bericht
news:opr2s9ww...@news.online.no...

One mistake you make is to output things to the browser before setting
headers... this is not ok and might be the reason noting happens.... so
remove all echo's in the lines preceeding the headers...

Marcel


0 new messages