Re: [PHP] Delivering NAMED pdf files
Thanks to all who offered suggestions. I have now solved the problem. Realising that what was actually happening was the offered filename being the same as the php script name, I built a routine which checks to see if a script with the desired .php exists and if not it copies my script to a file with that name. This takes place when the page is first loaded, redirecting to the next page in the web-process (remember that I'm doing all this with Lasso/Filemaker). The button on that page then calls for the script which pushes out the correctly named pdf document to the user. I have another button which asks for confirmation that the download was completed satisfactorily and that is used to delete the temporary .php script. This methgod may be of use to someone else. If so, please email me and I'll share my code. Regards George P in Edinburgh and looking forward to Frankfurt next week - Original Message - From: "Bill Rausch" <[EMAIL PROTECTED]> To: "George Pitcher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 8:22 PM Subject: RE: [PHP] Delivering NAMED pdf files > George, > > Rasmus' suggestion is correct, but he was terse as usual :) and you > might not have understood what he was saying. > > My solution is to present a list of the filenames available as LINKS > (to non-existent files). Then the script does what you've already > got. The problem is that some browsers "cheat" and ignore the > filename that you send in the headers "because they think they know > better" because of the URL that is currently active. So you fool them > by making a fake URL. > > In my case I have links that look like: > file.pdf > > and my dl.php script looks something like: > > ... > $uri = urldecode(substr($REQUEST_URI,8)); # skip over the /dl.php/ > $x = strpos( $uri, "?" ); # get rid of trailing SID, etc. > if( $x > 0 ) > $uri = substr($uri,0,$x); > > header( ... > header( ... > > readfile( "$realfileloc/$uri" ); > ... > > Bill > -- > Bill Rausch, Software Development, Unix, Mac, Windows > Numerical Applications, Inc. 509-943-0861 [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Delivering NAMED pdf files
George, Rasmus' suggestion is correct, but he was terse as usual :) and you might not have understood what he was saying. My solution is to present a list of the filenames available as LINKS (to non-existent files). Then the script does what you've already got. The problem is that some browsers "cheat" and ignore the filename that you send in the headers "because they think they know better" because of the URL that is currently active. So you fool them by making a fake URL. In my case I have links that look like: file.pdf and my dl.php script looks something like: ... $uri = urldecode(substr($REQUEST_URI,8)); # skip over the /dl.php/ $x = strpos( $uri, "?" ); # get rid of trailing SID, etc. if( $x > 0 ) $uri = substr($uri,0,$x); header( ... header( ... readfile( "$realfileloc/$uri" ); ... Bill -- Bill Rausch, Software Development, Unix, Mac, Windows Numerical Applications, Inc. 509-943-0861 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Delivering NAMED pdf files
George, your best bet is to have a table in your database which looks up the name of the file, based on a more friendly name. James . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Politicalia admin and editor e: [EMAIL PROTECTED] :: w: http://www.politicalia.com/ Today's Discussion, Tomorrow's Agenda. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . > -Original Message- > From: George Pitcher [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 19, 2001 2:42 PM > To: MrBaseball34; [EMAIL PROTECTED] > Subject: Re: [PHP] Delivering NAMED pdf files > > > Yes, > > If I download the file as it is named, it is the file I expected, only not > named the way I wanted. > > George > > "MrBaseball34" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > And the php page which is fileaccess.php: > > > > > > > > $fp1 = "D:\\Pdf\\" . $fp; > > > $len = filesize($fp1); > > > header("Content-Type: application/pdf"); > > > header("Content-Disposition: inline; filename=$fp1"); > > > header("Content-Length: $len"); > > > readfile($fp1); > > > ?> > > > > Have you CHECKED the value of $fp? > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
Yes, If I download the file as it is named, it is the file I expected, only not named the way I wanted. George "MrBaseball34" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > And the php page which is fileaccess.php: > > > > > $fp1 = "D:\\Pdf\\" . $fp; > > $len = filesize($fp1); > > header("Content-Type: application/pdf"); > > header("Content-Disposition: inline; filename=$fp1"); > > header("Content-Length: $len"); > > readfile($fp1); > > ?> > > Have you CHECKED the value of $fp? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
> > And the php page which is fileaccess.php: > > $fp1 = "D:\\Pdf\\" . $fp; > $len = filesize($fp1); > header("Content-Type: application/pdf"); > header("Content-Disposition: inline; filename=$fp1"); > header("Content-Length: $len"); > readfile($fp1); > ?> Have you CHECKED the value of $fp? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
James, I can. The text in square brackets is a pdf filename referenced in full from a Filemaker database using Lasso. And the php page which is fileaccess.php: HTH George - Original Message - From: "James Cox" <[EMAIL PROTECTED]> To: "George Pitcher" <[EMAIL PROTECTED]>; "Php-General@Lists. Php. Net" <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 12:45 PM Subject: RE: [PHP] Delivering NAMED pdf files > can you paste the full text of the code as you have it? I don't see anywhere > where you define the name of the file. > > James Cox > > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . > . > Politicalia admin and editor > e: [EMAIL PROTECTED] :: w: http://www.politicalia.com/ > Today's Discussion, Tomorrow's Agenda. > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . > . > > > > -Original Message- > > From: George Pitcher [mailto:[EMAIL PROTECTED]] > > Sent: Friday, October 19, 2001 12:27 PM > > To: speedboy; [EMAIL PROTECTED] > > Subject: Re: [PHP] Delivering NAMED pdf files > > > > > > Thanks for the [non] suggestion. > > > > I will not host these in a web-accessable directory. They are copyright > > materials. > > > > I've done this type of hosting previously using Frontier on a Mac and it > > worked fine. > > > > I thought that php was better than Frontier, though. > > > > George > > - Original Message - > > From: "speedboy" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, October 19, 2001 12:27 PM > > Subject: Re: [PHP] Delivering NAMED pdf files > > > > > > > > Thanks for the suggestion but it didn't change anything. > > > > > > It won't. Put them in a web accessible directory and don't use custom > > header calls because they do not work reliably. > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > _ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Delivering NAMED pdf files
can you paste the full text of the code as you have it? I don't see anywhere where you define the name of the file. James Cox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Politicalia admin and editor e: [EMAIL PROTECTED] :: w: http://www.politicalia.com/ Today's Discussion, Tomorrow's Agenda. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . > -Original Message- > From: George Pitcher [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 19, 2001 12:27 PM > To: speedboy; [EMAIL PROTECTED] > Subject: Re: [PHP] Delivering NAMED pdf files > > > Thanks for the [non] suggestion. > > I will not host these in a web-accessable directory. They are copyright > materials. > > I've done this type of hosting previously using Frontier on a Mac and it > worked fine. > > I thought that php was better than Frontier, though. > > George > - Original Message - > From: "speedboy" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, October 19, 2001 12:27 PM > Subject: Re: [PHP] Delivering NAMED pdf files > > > > > Thanks for the suggestion but it didn't change anything. > > > > It won't. Put them in a web accessible directory and don't use custom > header calls because they do not work reliably. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
Thanks for the [non] suggestion. I will not host these in a web-accessable directory. They are copyright materials. I've done this type of hosting previously using Frontier on a Mac and it worked fine. I thought that php was better than Frontier, though. George - Original Message - From: "speedboy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 12:27 PM Subject: Re: [PHP] Delivering NAMED pdf files > > Thanks for the suggestion but it didn't change anything. > > It won't. Put them in a web accessible directory and don't use custom header calls because they do not work reliably. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
Sebastian, Just tried it - it dosn't work for me. George - Original Message - From: "Sebastian" <[EMAIL PROTECTED]> To: "'George Pitcher'" <[EMAIL PROTECTED]>; "'Php-General" <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 12:19 PM Subject: AW: [PHP] Delivering NAMED pdf files Hi George I had the same problem a while ago. The only solution i found was to change the link to : www.blabla.com/pdffile/test.pdf test.pdf does not exist, but in /pdffile/ there is a .htaccess which redirects the 404 to the php script that reads/generates the pdfs. And for my purpose checks if user is authorized to get these files. sebastian > -Ursprüngliche Nachricht- > Von: George Pitcher [mailto:[EMAIL PROTECTED]] > Gesendet: Freitag, 19. Oktober 2001 12:55 > An: Arpad Tamas; [EMAIL PROTECTED] > Betreff: Re: [PHP] Delivering NAMED pdf files > > > Arpi, > > Thanks for the suggestion but it didn't change anything. > > George > > - Original Message - > From: "Arpad Tamas" <[EMAIL PROTECTED]> > To: "George Pitcher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, October 19, 2001 11:13 AM > Subject: Re: [PHP] Delivering NAMED pdf files > > > > On Friday 19 October 2001 11:52, George Pitcher wrote: > > > Hi all, > > > > > > I am delivering my PDF files from a non-internet > directory. The file > > > gets delivered but the filename is always changed to the > name of the > > > php script. > > > > > > Can anyone tell me how to get the file delivered so that the name > > > stays as it was on the server? > > It works this way for me on many browsers (included ie): > > > > header("Content-Type: application/octectstream"); > > header("Content-Disposition: filename=$name"); > > header("Pragma: no-cache"); > > header("Expires: 0"); > > > > Don't forget to double-check every capital letter, because > it matters > > in http and for most browsers too (for example your Content-Type's > > capitals are wrong below). > > Arpi > > > > > == > > > > > $fp1 = "D:\\Pdf\\" . $fp; > > > $len = filesize($fp1); > > > header("Content-type: application/pdf"); > > > header("Content-Disposition: inline; filename=$fp1"); > > > header("Content-Length: $len"); > > > readfile($fp1); > > > ?> > > > = > > > > > > Regards > > > > > > George Pitcher, Edinburgh > > > > > > > > > _ > > > Do You Yahoo!? > > > Get your free @yahoo.com address at http://mail.yahoo.com > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] To contact the list > administrators, e-mail: [EMAIL PROTECTED] > > _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
> Thanks for the suggestion but it didn't change anything. It won't. Put them in a web accessible directory and don't use custom header calls because they do not work reliably. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
AW: [PHP] Delivering NAMED pdf files
Hi George I had the same problem a while ago. The only solution i found was to change the link to : www.blabla.com/pdffile/test.pdf test.pdf does not exist, but in /pdffile/ there is a .htaccess which redirects the 404 to the php script that reads/generates the pdfs. And for my purpose checks if user is authorized to get these files. sebastian > -Ursprüngliche Nachricht- > Von: George Pitcher [mailto:[EMAIL PROTECTED]] > Gesendet: Freitag, 19. Oktober 2001 12:55 > An: Arpad Tamas; [EMAIL PROTECTED] > Betreff: Re: [PHP] Delivering NAMED pdf files > > > Arpi, > > Thanks for the suggestion but it didn't change anything. > > George > > - Original Message - > From: "Arpad Tamas" <[EMAIL PROTECTED]> > To: "George Pitcher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, October 19, 2001 11:13 AM > Subject: Re: [PHP] Delivering NAMED pdf files > > > > On Friday 19 October 2001 11:52, George Pitcher wrote: > > > Hi all, > > > > > > I am delivering my PDF files from a non-internet > directory. The file > > > gets delivered but the filename is always changed to the > name of the > > > php script. > > > > > > Can anyone tell me how to get the file delivered so that the name > > > stays as it was on the server? > > It works this way for me on many browsers (included ie): > > > > header("Content-Type: application/octectstream"); > > header("Content-Disposition: filename=$name"); > > header("Pragma: no-cache"); > > header("Expires: 0"); > > > > Don't forget to double-check every capital letter, because > it matters > > in http and for most browsers too (for example your Content-Type's > > capitals are wrong below). > > Arpi > > > > > == > > > > > $fp1 = "D:\\Pdf\\" . $fp; > > > $len = filesize($fp1); > > > header("Content-type: application/pdf"); > > > header("Content-Disposition: inline; filename=$fp1"); > > > header("Content-Length: $len"); > > > readfile($fp1); > > > ?> > > > = > > > > > > Regards > > > > > > George Pitcher, Edinburgh > > > > > > > > > _ > > > Do You Yahoo!? > > > Get your free @yahoo.com address at http://mail.yahoo.com > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] To contact the list > administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
Arpi, Thanks for the suggestion but it didn't change anything. George - Original Message - From: "Arpad Tamas" <[EMAIL PROTECTED]> To: "George Pitcher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 11:13 AM Subject: Re: [PHP] Delivering NAMED pdf files > On Friday 19 October 2001 11:52, George Pitcher wrote: > > Hi all, > > > > I am delivering my PDF files from a non-internet directory. The > > file gets delivered but the filename is always changed to the name > > of the php script. > > > > Can anyone tell me how to get the file delivered so that the name > > stays as it was on the server? > It works this way for me on many browsers (included ie): > > header("Content-Type: application/octectstream"); > header("Content-Disposition: filename=$name"); > header("Pragma: no-cache"); > header("Expires: 0"); > > Don't forget to double-check every capital letter, because it matters > in http and for most browsers too (for example your Content-Type's > capitals are wrong below). > Arpi > > > == > > > $fp1 = "D:\\Pdf\\" . $fp; > > $len = filesize($fp1); > > header("Content-type: application/pdf"); > > header("Content-Disposition: inline; filename=$fp1"); > > header("Content-Length: $len"); > > readfile($fp1); > > ?> > > = > > > > Regards > > > > George Pitcher, Edinburgh > > > > > > _ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
Rasmus, Thanks for the suggestion but it didn't change anything. George - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "George Pitcher" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 10:54 AM Subject: Re: [PHP] Delivering NAMED pdf files > The obvious hack would be to simply make the link: > > http://your.domain.com/script.php/filename_you_want.pdf > > -Rasmus > > On Fri, 19 Oct 2001, George Pitcher wrote: > > > Hi all, > > > > I am delivering my PDF files from a non-internet directory. The file gets > > delivered but the filename is always changed to the name of the php script. > > > > Can anyone tell me how to get the file delivered so that the name stays as > > it was on the server? > > > > My PHP code. This is all the php code I use in my site (so far). > > == > > > $fp1 = "D:\\Pdf\\" . $fp; > > $len = filesize($fp1); > > header("Content-type: application/pdf"); > > header("Content-Disposition: inline; filename=$fp1"); > > header("Content-Length: $len"); > > readfile($fp1); > > ?> > > = > > > > Regards > > > > George Pitcher, Edinburgh > > > > > > _ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > > > _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
On Friday 19 October 2001 11:52, George Pitcher wrote: > Hi all, > > I am delivering my PDF files from a non-internet directory. The > file gets delivered but the filename is always changed to the name > of the php script. > > Can anyone tell me how to get the file delivered so that the name > stays as it was on the server? It works this way for me on many browsers (included ie): header("Content-Type: application/octectstream"); header("Content-Disposition: filename=$name"); header("Pragma: no-cache"); header("Expires: 0"); Don't forget to double-check every capital letter, because it matters in http and for most browsers too (for example your Content-Type's capitals are wrong below). Arpi > == > $fp1 = "D:\\Pdf\\" . $fp; > $len = filesize($fp1); > header("Content-type: application/pdf"); > header("Content-Disposition: inline; filename=$fp1"); > header("Content-Length: $len"); > readfile($fp1); > ?> > = > > Regards > > George Pitcher, Edinburgh > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delivering NAMED pdf files
The obvious hack would be to simply make the link: http://your.domain.com/script.php/filename_you_want.pdf -Rasmus On Fri, 19 Oct 2001, George Pitcher wrote: > Hi all, > > I am delivering my PDF files from a non-internet directory. The file gets > delivered but the filename is always changed to the name of the php script. > > Can anyone tell me how to get the file delivered so that the name stays as > it was on the server? > > My PHP code. This is all the php code I use in my site (so far). > == > $fp1 = "D:\\Pdf\\" . $fp; > $len = filesize($fp1); > header("Content-type: application/pdf"); > header("Content-Disposition: inline; filename=$fp1"); > header("Content-Length: $len"); > readfile($fp1); > ?> > = > > Regards > > George Pitcher, Edinburgh > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Delivering NAMED pdf files
Hi all, I am delivering my PDF files from a non-internet directory. The file gets delivered but the filename is always changed to the name of the php script. Can anyone tell me how to get the file delivered so that the name stays as it was on the server? My PHP code. This is all the php code I use in my site (so far). == = Regards George Pitcher, Edinburgh _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]