ReeceSayer Posted October 19, 2012 Share Posted October 19, 2012 (edited) Hi All, I'm trying to set up some code to download a CSV file from an ftp host and then i want to do something with it. However, i can't quite get the code to work. I get the following error: Warning: ftp_get() [function.ftp-get]: Failed to open file. in /home/rsyr/restofthedirectories/ on line 8 Here's the code, excuse the messiness: <?php $today = date("Y-m-d"); $conn = ftp_connect("ftp.zois.co.uk") or die("Could not connect"); ftp_login($conn,"anonymous",""); echo "JCP-scrape-". $today; echo ftp_get($conn,"JCP-scrape-18-10-2012.csv", "/pub/jcp/JCP-scrape-18-10-2012.csv", FTP_ASCII); ftp_close($conn); //sql code to move data from holding table to vacancy table //INSERT INTO vacancy (title, jobref, location, description, apply) SELECT title, reference, location, description, apply FROM holdingtable //truncate holdingtable //Holding table should then be truncated ?> Thanks Edited October 19, 2012 by ReeceSayer Quote Link to comment https://forums.phpfreaks.com/topic/269682-ftp-issues-failed-to-open-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 19, 2012 Share Posted October 19, 2012 You apparently copy/pasted the code from some rich-text/formatted source. Please go back and copy/paste just the plain text from your programming editor. Quote Link to comment https://forums.phpfreaks.com/topic/269682-ftp-issues-failed-to-open-file/#findComment-1386359 Share on other sites More sharing options...
ReeceSayer Posted October 19, 2012 Author Share Posted October 19, 2012 You apparently copy/pasted the code from some rich-text/formatted source. Please go back and copy/paste just the plain text from your programming editor. It should have changed now i've edited the post, i copied it straight from Notepad++, not sure what the problem was. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/269682-ftp-issues-failed-to-open-file/#findComment-1386363 Share on other sites More sharing options...
ReeceSayer Posted October 22, 2012 Author Share Posted October 22, 2012 Just an FYI. I've solved this issue it was due to using the incorrect case in a filename. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/269682-ftp-issues-failed-to-open-file/#findComment-1386923 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.