Greetings!
I am developing a site for a client of mine, who needs to provide his clients access to numerous .pdf files by way of downloadable links on his website. I have been playing with the ftp_get, ftp_login, and ftp_connect functions for several hours now, and I dont seem to be able to figure it out. I am able to connect, and I have been able to successfully upload a file to the FTP site from the webserver, but I do not seem to be able to download one. It gives me an error because the program does not have the right to create files on the webserver (which I believe to be the default destination for downloaded files). I also seem to be having access errors with the FTP connection because when I create hyperlinks to the file I would like to download, and then right click on the link and select "Save Target As", I get a "Login request was denied" IE error message. My questions are:
Is there a way to download files to the USERS LOCAL machine, instead of to the webserver where the php code sits?
Is there a way to create hyperlinks to download from an external FTP server directly to the users machine?
Why, when I can verify that I am logged into the FTP server, do I get error messages when I click on links on the same page that point to the FTP server that I am currently logged into?
Heres the test code I have been using:
<?php
$server = "xx.xxx.xxx.xx";
$user = "username";
$password = "password";
$connection = ftp_connect($server);
ftp_login($connection, $user, $password);
echo "<br/><a href=\"ftp://xx.xxx.xxx.xx/document.pdf\"> Click Here";
echo "<br/></a>";
?>
Any help would be greatly appreciated!