Get Large Files over HTTP in ColdFusion

Friday 27 December 2013 01:53 PM

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.