grissom Posted October 11, 2009 Share Posted October 11, 2009 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 More sharing options...
Daniel0 Posted October 11, 2009 Share Posted October 11, 2009 Is this possible using ftp_get, or do I have to use some other way ? Did you try it? Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935092 Share on other sites More sharing options...
grissom Posted October 11, 2009 Author Share Posted October 11, 2009 I haven't tried it using ftp_get in case I ended up pasting files all over the server in places where I didn't want them. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935096 Share on other sites More sharing options...
grissom Posted October 12, 2009 Author Share Posted October 12, 2009 anybody ? Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935293 Share on other sites More sharing options...
grissom Posted October 13, 2009 Author Share Posted October 13, 2009 guess I'm on my own then ... ? Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935934 Share on other sites More sharing options...
Daniel0 Posted October 13, 2009 Share Posted October 13, 2009 Is this possible using ftp_get, or do I have to use some other way ? Did you try it? We're not here to research for you after all. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935935 Share on other sites More sharing options...
grissom Posted October 13, 2009 Author Share Posted October 13, 2009 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. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935993 Share on other sites More sharing options...
trq Posted October 13, 2009 Share Posted October 13, 2009 Your code works beautifully for me. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935996 Share on other sites More sharing options...
Daniel0 Posted October 13, 2009 Share Posted October 13, 2009 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. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-935997 Share on other sites More sharing options...
grissom Posted October 13, 2009 Author Share Posted October 13, 2009 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 ? Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-936067 Share on other sites More sharing options...
Psycho Posted October 13, 2009 Share Posted October 13, 2009 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. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-936143 Share on other sites More sharing options...
grissom Posted October 13, 2009 Author Share Posted October 13, 2009 *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. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-936152 Share on other sites More sharing options...
Daniel0 Posted October 13, 2009 Share Posted October 13, 2009 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. Link to comment https://forums.phpfreaks.com/topic/177350-download-directory-onto-c-drive/#findComment-936212 Share on other sites More sharing options...
Recommended Posts