Re: Force file download with header

From: Date: Mon, 06 Jan 2003 21:52:12 +0000
Subject: Re: Force file download with header
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-130498@lists.php.net to get a copy of this message
Thanks Chris, I will check it out.. "Chris Shiflett" <shiflett@php.net> wrote in message news:20030106214706.1431.qmail@web14305.mail.yahoo.com... > --- Altug Sahin <altug@bonsai-apart.com> wrote: > > <? > > $file = $_POST[fileID]; > > $files_folder = "C:\\temp\\"; > > $dlfile = $files_folder.$file; > > > > header("Content-type: application/pdf"); > > readfile("$dlfile"); > > ?> > > > > I get this... > > "Warning: readfile("C:\temp\test.pdf") - No such file or > > directory in c:\inetpub\wwwroot\dlQ_safe.php on line 10" > > > > The test.pdf file is of course there... > > My guess is that the test.pdf file is of course not there. > > You can try to use file_exists() if you do not trust the > warning message, but I see no reason not to trust it. > > > What do I need to add to this script so that whatever a > > pdf filename is submitted, acrobat will open this file > > in the user's browser? > > This is a different question, but search for examples on > using the Content-Disposition header. I believe there is a > directive called "inline" that you can give it to try to > force a browser to display the content inline rather than > prompt for a download. > > Chris

« previous php.general (#130498) next »