FTP Get File

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CEJ
Forum Newbie
Posts: 8
Joined: Tue Mar 07, 2006 9:39 pm

FTP Get File

Post by CEJ »

Hey. I'm kind of new to PHP so cut me some slack if some things don't match up :D .

I'm trying to use ftp_get() to download a file from a private ftp server (that I have access to). However, the problem is that I'm doing this on the server of a website I'm helping a friend to design, so the local route of the function becomes the working directory on the ftp server of the website. I want to download the files from the private ftp server to my computer hard drive, NOT to the website's ftp. All my attempts at using this function thus far have succeeded in downloading the file, but to the website's ftp. Is there any way (or possibly another function) to download the files to my computer's hard drive?

Thanks,
-CEJ
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

  • execute it from your computer
  • download the file to the webserver, then upload it to your computer
CEJ
Forum Newbie
Posts: 8
Joined: Tue Mar 07, 2006 9:39 pm

Post by CEJ »

1) Can't. :(

2) If I'm going to do that, and have to eventually end up using an FTP client, then I might as well just connect to the private ftp server via an ftp client from the beginning and grab the file that way, rather than using my browser to download the file to the webserver, and then using an ftp client to download it to my home computer.
The other problem with that is this is supposed to be something that entirely eliminates the need for an ftp client. Furthermore, many users (who have accounts on the private ftp server, but not necessarily the webserver) will be using this feature.

Are those the _only_ two ways of getting the file on my home computer?

-CEJ
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Those are the only automated ways, which sounds like what you wanted from reading your first post. If you wanted to manually request it, then you will have to ftp it to the webserver then create a download for the user to select where on their system to download it from the webserver.

That's all I can see.
CEJ
Forum Newbie
Posts: 8
Joined: Tue Mar 07, 2006 9:39 pm

Post by CEJ »

Automated would have been preferrable, but creating a download from the webserver would work. Only, I'm not quite sure how to do it :? It would be great if you could point me to a tutorial page that explains it (or if you're feeling generous, explain it right here :P ).

But still, if anyone knows of a way, or some trick to bypass the webserver and download the file directory to my hard drive, I would be much obliged ;).

Thanks,
-CEJ
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

search around for "force download" and/or look at header()
Post Reply