Not a problem I have had as yet...

There is a documented feature of CFHTTP that allows you to load up a
comma-delimited file into memory via CFHTTP.  This is useful if (and this is
the case) you can't use CFFile to load up a comma-delimited file (CFX_File
has a max size of 64KB for a read) and you can't set up a csv datasource in
the CF Administrator.  Using CFHTTP you can load up a comma-delimited file
into a recordset like this:

<cfhttp url="http://www.myurl.com/mytextfile.csv"
        method="GET"
        name="data"
        columns="title,keywords,mytext,x"
>
</cfhttp>

and this then loads the cfhttp.filecontent as a query, and you can reference
that query via:

<cfoutput>
<cfquery name="data">
<b>#title#</b><br>#keywords#<br>#mytext#
</cfquery>
</cfoutput>

"Hooray" you might think! This means that if someone disables the CFFile
tag, you can still load up data from a comma-delimited list!

Problem:

The documentation says that if you don't specify the columns, CF ignores the
first line of the page and uses those values as the column names.

I run this with column names, and it ignores the first line anwyay and just
goes to the second line.  It also seems to ignore the last line.

I have tried several things like adding a line break and/or carriage return
at the start and end.  I have tried testing on just one record...

It seems to think that the first line has the wrong number of
comma-delimited fields and so it won't put it into the recordset.  However,
I have checked the missing records, and they have the same number of fields
as every other one (it's a database export - from a database I don't have
any access to, so I need an export - so it should do!).

If you've got this far, then you've done well.  If you can think of anything
else then please tell me.  If you know of any problems, then let me know!

Paul
----------------------------
Paul Johnston
PJ Net Solutions Ltd
E: [EMAIL PROTECTED]
M: 07866 573013


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to