This works for what I do:
Try this and fiddle with the variables.
$conn_id is your pointer to an FTP connection.
Familiarize yourself with the FTP functions in PHP if there are any doubts.

PART I: Put this in one script (say "pdf_list.php"):
// list server contents
if ((!$F) || ($F=="")){
      $dir_list = @ftp_nlist($conn_id, "");
      if (!empty($dir_list)){
          while (list($lvar, $lvalue) = each($dir_list)){
          $S = @ftp_size ($conn_id, $lvalue);
          echo "$lvalue&nbsp;&nbsp;$S&nbsp;&nbsp;[<a
href=\"download.pdf%20.php?F=http://$ftp_server/$my_dir$lvalue&S=$S\";>DOWNLO
AD</a>]<br>";
          }
      }
      else {
          echo "No files available!<br>";
      }
}

PART II: And save this as a separate file ("download.pdf .php"):
<==observation: there is a space in this file name. See above: "%20"!
<?php
//You can submit $Dir, $File_Name, $File_Extension by another script
adapting to your needs.
header("Server:Keep-Alive");
header("Accept-Ranges: $S-$S/$S");
header("Content-Length: $S");
header("Content-disposition: filename=$F");
header("Content-type: application/force-download");
readfile("$F");
?>

Payment can be made with a thousand blondes from the Netherlands: in
bikinis - no camels accepted!
(Fine print: "they must be pretty - the girls, not the camels!")


"Sjoerd Van Oosten" <[EMAIL PROTECTED]> wrote in message
C9F89DA57491D511BDAF00E0180C348103BFCC@ESADM01">news:C9F89DA57491D511BDAF00E0180C348103BFCC@ESADM01...
> Hello, a question again.
>
> I have a pdf file which can be downloaded. How can i link to this file so,
> that the file isn't opened in the browser (if acrobat reader is installed)
> but the file download popup appears?
>
> Greetings,
>
> ________________________________________
> Sjoerd van Oosten
> Digitaal vormgever [EMAIL PROTECTED]
> Datamex E-sites B.V.
> http://www.esites.nl
> Minervum 7368 Telefoon: (076) 5 730 730
> 4817 ZH BREDA Telefax: (076) 5 877 757
> _______________________________________
>





-- 
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]

Reply via email to