> Why not just store them somewhere under your web root, and 
> then use cfhttp to read them in as query objects.

Yeah, this would work but not really a solution I want to implement, instead
I have used the following lines of code to convert it from tab to comma
delimited on download...

<cfset modFile = cfhttp.FileContent>
<cfset modFile = replace(modFile,chr(10),chr(13) & chr(10),'ALL')>
<cfset modFile = replace(modFile,'"','','ALL')>
<cfset modFile = reReplace(modFile,'\t([^\t]+,.*?)\t',' "\1"    ','ALL')>
<cfset modFile = replace(modFile,'      ',',','ALL')>

The first one reformats the line breaks to make them more windows friendly,
the second strips out any existing quotes that would screw up the csv
formatting, the third line places quotes arround any field that contains a
comma and the final line replaces all the tabs with commas.

So far this seems to be working fine and now the files are csv they are
being read properly.  Another example of the power of regex (although I am
sure someone will now show me a simpler, faster regex string and make me
feel silly ;-)

--
Jay


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:260834
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to