Get Large Files over HTTP in ColdFusion

What would you do if you have to fetch out a large file form a slow server over http? Well, it is quite simple. Use CFHTTP and set a reasonable timeout value, 10 minutes in my case. Ran my .cfm file. CFHTTP did establish the connection. Download the file halfway and timeout without any regard to my 10 minute instructions. I’m not really sure the reason for this behavior. It might be the old server I’m talking to or it might be the Krampus. I got quite lot of work to finish today. My Coffee is almost finish. Here is the JAVA code that saves the day. Pass in the source(URL) and the destination (location you want the file to be saved), it should download the file into your server. Default connection timeout is set to 10 seconds and file load timeout set to 60 seconds.

2 Comments :
Misty
Wednesday 21 May 2014 02:28 PM
Hi Sam, One thing is for sure, Even CF fails at some point, Java is to rescue and it does it in good way. Thanks for the Code, It is Great One.
Sunday 27 April 2014 11:06 PM
Regardless of what timeout you set on your cfhttp tag, your page will still timeout at the normal time if you don't also use cfsetting to set the request timeout value for the page.