Can you isolate code from the CF10 compiler?

So, I'm new to coding in coldfusion, this is my second month, so bear with me on this.

My client client wants to upload multiple files, handling errors smoothly, which means that it will continue through all downloads even if an error occurs.

Thus, with CF11, I can use uploadAll with optional continueOnError and Errors values, making it easy to process multiple files.

The problem is that my test server-employer still only has CF10, and in the near future it may not be updated. Therefore, continueOnError and Error will not work when compiling on our test server, but not on the client server.

I would like to do something like:

<cfif SERVER.ColdFusion.ProductVersion gte 11> <optimal cffile uploadAll code> <cfelse> <suboptimal cffile uploadAll code> </cfif> 

And there are no problems with compilation. But the test server in any case has a problem with the code. Is there a way that this can be done in code? If not, is there a way I can do this quite easily ... ish?

+3
source share
1 answer

Use <cfinclude> .

 <cfif SERVER.ColdFusion.ProductVersion gte 11> <cfinclude template="newWay.cfm"> <cfelse> <cfinclude template="oldWay.cfm"> </cfif> 

Here's how cfbackport does it: https://github.com/misterdai/cfbackport/blob/master/cfbackport.cfm

+8
source

All Articles