Jump to content

Recommended Posts

Hi folks

 

I am attempting (if this is possible) to write a routine to automatically dump the contents of a directory on the server into a directory on the local C drive.

 

I started out like this :

 

$conn_id = ftp_connect($myurl);
$login_successful = ftp_login($conn_id, $id, $password);
if ($login_successful) {
	echo '<H2>Download underway ...'.PHP_EOL;
	$contents = ftp_nlist($conn_id, $the_appropriate_path); 
	foreach ($contents as $file) {
		echo $file.'<BR>'.PHP_EOL;
		}

 

 

And this does exactly as expected, it lists all the files in the directory on the server !

 

 

Now I have to dump them onto my C drive.  Is this possible using ftp_get, or do I have to use some other way ?

Link to comment
https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/
Share on other sites

Well EXCUSE ME Daniel0 I thought this was a help forum and the whole idea was to help out other coders !

 

Where the hell did I ask you to research for me ? 

 

I just want some help.  If you are going to be stroppy, please stand aside so someone more helpful can contribute.

Well EXCUSE ME Daniel0 I thought this was a help forum and the whole idea was to help out other coders !

 

It is.

 

Where the hell did I ask you to research for me ?

 

You said yourself you haven't tried it, and the fact that you keep bumping your topic even though you haven't even tried it yourself strongly suggests that you want other people to do it for you.

 

If you are going to be stroppy, please stand aside so someone more helpful can contribute.

 

Has it ever occurred to you that you haven't received any responses because this is something you should just do yourself? You can just test if the function does what you want it to just like everybody else.

I explained why I have not tried it, if you took the time to read my posts. 

 

I am looking for a routine to download onto the local machine, however I am keen to solicit views from people who have used ftp_get() because I had heard that ftp_get() can only transfer files from one server to another and not onto a local machine.  As I explained in my posts, I do not want to risk it in case I just end up pasting files all over the server.

 

I am not asking ANYBODY to try it out for me and I am NOT asking anybody to take this risk for me. 

 

I am simply asking : has anybody got any experience of using this function to download onto the local machine and did it work ?

 

I had heard that ftp_get() can only transfer files from one server to another and not onto a local machine

 

From the manual:

 

ftp_get() retrieves a remote file from the FTP server, and saves it into a local file.

 

The description is pretty clear.

 

 

I do not want to risk it in case I just end up pasting files all over the server.

 

Then just test using a single file, ensure you get the results you want, and then implement in your current code to process all the files. The manual includes a very simple example that should make it easy to get started.

 

...has anybody got any experience of using this function to download onto the local machine and did it work ?

 

OK, now you are just being silly. Are you really asking if a PHP function works? It's not like the manual is filled with functions that don't work. It would take less than 5 minutes to copy the example from the manual to test it for yourself. You already had your answer when you started this thread.

*sigh*

 

Forget it, I've spoken to real programmer who confirmed that

 

1. by local file it means local to your server not your local client

 

2. So if I had tried using this function then it would not have worked in the way I wanted

 

You could of course have just said that quickly and easily if you had known, but you tried to hide your ignorance and inability to answer a simple question by arrogance instead.

2. So if I had tried using this function then it would not have worked in the way I wanted

 

Which you could have tested way faster than the 39 hours between your creation of this topic and your last post. Either way, you're obviously flamebaiting, so this topic is locked.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.