{"id":472,"date":"2011-08-22T17:49:21","date_gmt":"2011-08-22T22:49:21","guid":{"rendered":"http:\/\/osric.com\/chris\/accidental-developer\/?p=472"},"modified":"2011-08-22T17:52:39","modified_gmt":"2011-08-22T22:52:39","slug":"cfftp-transfers-a-zero-byte-file-and-throws-a-timeout-error","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2011\/08\/cfftp-transfers-a-zero-byte-file-and-throws-a-timeout-error\/","title":{"rendered":"CFFTP Transfers a Zero-Byte File and Throws a Timeout Error"},"content":{"rendered":"<p>Although I&#8217;ve used ColdFusion for 7+ years now, I&#8217;ve never used the cfftp tag before. Yesterday, I found a reason to try it out. I figured it would be as simple as cfhttp&#8211;and it was, with one exception (no pun intended).<\/p>\n<p>Here is my sample code:<\/p>\n<pre><code>&lt;cfftp action=\"open\" \r\n    connection=\"test\"\r\n    server=\"ftp.osric.com\"\r\n    username=\"chris\"\r\n    password=\"********************\"\r\n    timeout=\"60\"\r\n    stoponerror=\"yes\"&gt;\r\n&lt;cfftp  \r\n    connection = \"test\" \r\n    action = \"getFile\"  \r\n    name = \"downloadFile\"  \r\n    transferMode = \"binary\"  \r\n    localFile = \"S:\\chris\\handlebar-moustache.jpg\"  \r\n    remoteFile = \"handlebar-moustache.jpg\"\r\n    timeout=\"60\"&gt;<\/code><\/pre>\n<p>Here&#8217;s the error message it produced:<br \/>\n<code>An error occurred during the FTP getFile operation.<br \/>\nError: getFile operation exceeded timeout.<\/code><\/p>\n<p>However, the local file was still created (as a zero-byte file).<\/p>\n<p>The solution, in my case, was to turn on passive mode (add attribute <code>passive=\"yes\"<\/code> to the cfftp tag).<\/p>\n<p><a href=\"http:\/\/slacksite.com\/other\/ftp.html\">Active FTP vs. Passive FTP, a Definitive Explanation<\/a> has a brief explanation of the differences between active and passive FTP.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although I&#8217;ve used ColdFusion for 7+ years now, I&#8217;ve never used the cfftp tag before. Yesterday, I found a reason to try it out. I figured it would be as simple as cfhttp&#8211;and it was, with one exception (no pun intended). Here is my sample code: &lt;cfftp action=&#8221;open&#8221; connection=&#8221;test&#8221; server=&#8221;ftp.osric.com&#8221; username=&#8221;chris&#8221; password=&#8221;********************&#8221; timeout=&#8221;60&#8243; stoponerror=&#8221;yes&#8221;&gt; &lt;cfftp &hellip; <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2011\/08\/cfftp-transfers-a-zero-byte-file-and-throws-a-timeout-error\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">CFFTP Transfers a Zero-Byte File and Throws a Timeout Error<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[210,349,209],"class_list":["post-472","post","type-post","status-publish","format-standard","hentry","category-coldfusion","tag-cfftp","tag-coldfusion","tag-ftp"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=472"}],"version-history":[{"count":10,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/472\/revisions"}],"predecessor-version":[{"id":497,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/472\/revisions\/497"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}