This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C0549C.EDA1C16A
Content-Type: text/plain;
        charset="iso-8859-1"

You could do something like this.


        <cfset dirPath = "E:\somewhere\folder">
        <cftry>
        <cffile action="UPLOAD"  filefield="CSVFile" destination="#dirPath#"
nameconflict="OVERWRITE"> 
        <cfcatch type="any">
                <cfabort showerror="You must attach a .csv document :
#cfcatch.message#">
        </cfcatch >
        </cftry>

        
<cftry>
<cfif isDefined("file.clientFile") and Len(file.clientFile)>
<CFFILE ACTION="Read" FILE="#dirPath#\#File.ClientFile#" VARIABLE="CSVFile">
        <cfset mail = QueryNew("MailTo,FName,LName")>
        <cfparam name="counter" default="1">
        <cfloop list="#CSVFile#" delimiters="#CHR(13)##CHR(10)#"
index="thisLine">
                        <CFSET newRow  = QueryAddRow(mail, 1)>
                        <cfset temp =
QuerySetCell(mail,"MailTo",ListGetAt(thisLine, 1))>             
                        <cfset temp =
QuerySetCell(mail,"FName",ListGetAt(thisLine, 2))>
                        <cfset temp =
QuerySetCell(mail,"LName",ListGetAt(thisLine, 3))>
         <cfset counter = IncrementValue(counter)>
        </cfloop>
        </cfif>
<cfcatch type="any">
        <cfabort showerror="There was a problem working with your .csv file,
<br> ensure that you have created a .csv file with the following fields.
<br> <b>EmailTo,FirstName,LastName</b> <br> #cfcatch.message#">
</cfcatch>
</cftry> 


HTH,

Robert Hinojosa 
Senior WebDeveloper 
[EMAIL PROTECTED] 
www.hencie.com 
972-671-0011 ext.284  



-----Original Message-----
From: Richard Gilbert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 22, 2000 9:49 AM
To: CF-Talk
Subject: CSV-to-Query


Greetings!

I am struggling with the notion of trying to query a CSV. For some reason
CFHTTP does not work for me. And I am also having trouble setting up a csv
file as a datasource in CF Admin. (verify=failed)

Do any of you know of a custom tag for this purpose?

Thanks in advance,
Richard

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

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

------_=_NextPart_001_01C0549C.EDA1C16A
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>RE: CSV-to-Query</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>You could do something like this.</FONT>
</P>
<BR>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfset =
dirPath =3D &quot;E:\somewhere\folder&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;cftry&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;cffile action=3D&quot;UPLOAD&quot;&nbsp; =
filefield=3D&quot;CSVFile&quot; destination=3D&quot;#dirPath#&quot; =
nameconflict=3D&quot;OVERWRITE&quot;&gt; </FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;cfcatch type=3D&quot;any&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfabort =
showerror=3D&quot;You must attach a .csv document : =
#cfcatch.message#&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;/cfcatch &gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;/cftry&gt;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<BR><FONT SIZE=3D2>&lt;cftry&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;cfif isDefined(&quot;file.clientFile&quot;) and =
Len(file.clientFile)&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;CFFILE ACTION=3D&quot;Read&quot; =
FILE=3D&quot;#dirPath#\#File.ClientFile#&quot; =
VARIABLE=3D&quot;CSVFile&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfset =
mail =3D QueryNew(&quot;MailTo,FName,LName&quot;)&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;cfparam name=3D&quot;counter&quot; =
default=3D&quot;1&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;cfloop list=3D&quot;#CSVFile#&quot; =
delimiters=3D&quot;#CHR(13)##CHR(10)#&quot; =
index=3D&quot;thisLine&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;CFSET =
newRow&nbsp; =3D QueryAddRow(mail, 1)&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfset =
temp =3D QuerySetCell(mail,&quot;MailTo&quot;,ListGetAt(thisLine, =
1))&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfset =
temp =3D QuerySetCell(mail,&quot;FName&quot;,ListGetAt(thisLine, =
2))&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfset =
temp =3D QuerySetCell(mail,&quot;LName&quot;,ListGetAt(thisLine, =
3))&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT SIZE=3D2> =
&lt;cfset counter =3D IncrementValue(counter)&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;/cfloop&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;/cfif&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;cfcatch type=3D&quot;any&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;cfabort showerror=3D&quot;There was a problem working with =
your .csv file, &lt;br&gt; ensure that you have created a .csv file =
with the following fields. &lt;br&gt; =
&lt;b&gt;EmailTo,FirstName,LastName&lt;/b&gt; &lt;br&gt; =
#cfcatch.message#&quot;&gt;</FONT></P>

<P><FONT SIZE=3D2>&lt;/cfcatch&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/cftry&gt; </FONT>
</P>
<BR>

<P><FONT SIZE=3D2>HTH,</FONT>
</P>

<P><FONT SIZE=3D2>Robert Hinojosa </FONT>
<BR><FONT SIZE=3D2>Senior WebDeveloper </FONT>
<BR><FONT SIZE=3D2>[EMAIL PROTECTED] </FONT>
<BR><FONT SIZE=3D2>www.hencie.com </FONT>
<BR><FONT SIZE=3D2>972-671-0011 ext.284&nbsp; </FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Richard Gilbert [<A =
HREF=3D"mailto:[EMAIL PROTECTED]">mailto:Rich@internet4asso=
ciations.com</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Wednesday, November 22, 2000 9:49 AM</FONT>
<BR><FONT SIZE=3D2>To: CF-Talk</FONT>
<BR><FONT SIZE=3D2>Subject: CSV-to-Query</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Greetings!</FONT>
</P>

<P><FONT SIZE=3D2>I am struggling with the notion of trying to query a =
CSV. For some reason</FONT>
<BR><FONT SIZE=3D2>CFHTTP does not work for me. And I am also having =
trouble setting up a csv</FONT>
<BR><FONT SIZE=3D2>file as a datasource in CF Admin. =
(verify=3Dfailed)</FONT>
</P>

<P><FONT SIZE=3D2>Do any of you know of a custom tag for this =
purpose?</FONT>
</P>

<P><FONT SIZE=3D2>Thanks in advance,</FONT>
<BR><FONT SIZE=3D2>Richard</FONT>
</P>

<P><FONT =
SIZE=3D2>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</FONT>
<BR><FONT SIZE=3D2>Structure your ColdFusion code with Fusebox. Get the =
official book at <A HREF=3D"http://www.fusionauthority.com/bkinfo.cfm" =
TARGET=3D"_blank">http://www.fusionauthority.com/bkinfo.cfm</A></FONT>
</P>

<P><FONT SIZE=3D2>Archives: <A =
HREF=3D"http://www.mail-archive.com/[email protected]/" =
TARGET=3D"_blank">http://www.mail-archive.com/[email protected]/=
</A></FONT>
<BR><FONT SIZE=3D2>Unsubscribe: <A =
HREF=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists" =
TARGET=3D"_blank">http://www.houseoffusion.com/index.cfm?sidebar=3Dlists=
</A></FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C0549C.EDA1C16A--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to