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> <FONT SIZE=3D2><cfset =
dirPath =3D "E:\somewhere\folder"></FONT>
<BR> <FONT =
SIZE=3D2><cftry></FONT>
<BR> <FONT =
SIZE=3D2><cffile action=3D"UPLOAD" =
filefield=3D"CSVFile" destination=3D"#dirPath#" =
nameconflict=3D"OVERWRITE"> </FONT>
<BR> <FONT =
SIZE=3D2><cfcatch type=3D"any"></FONT>
<BR> =
<FONT SIZE=3D2><cfabort =
showerror=3D"You must attach a .csv document : =
#cfcatch.message#"></FONT>
<BR> <FONT =
SIZE=3D2></cfcatch ></FONT>
<BR> <FONT =
SIZE=3D2></cftry></FONT>
</P>
<P> =20
<BR><FONT SIZE=3D2><cftry></FONT>
<BR><FONT SIZE=3D2><cfif isDefined("file.clientFile") and =
Len(file.clientFile)></FONT>
<BR><FONT SIZE=3D2><CFFILE ACTION=3D"Read" =
FILE=3D"#dirPath#\#File.ClientFile#" =
VARIABLE=3D"CSVFile"></FONT>
<BR> <FONT SIZE=3D2><cfset =
mail =3D QueryNew("MailTo,FName,LName")></FONT>
<BR> <FONT =
SIZE=3D2><cfparam name=3D"counter" =
default=3D"1"></FONT>
<BR> <FONT =
SIZE=3D2><cfloop list=3D"#CSVFile#" =
delimiters=3D"#CHR(13)##CHR(10)#" =
index=3D"thisLine"></FONT>
<BR> =
=
<FONT SIZE=3D2><CFSET =
newRow =3D QueryAddRow(mail, 1)></FONT>
<BR> =
=
<FONT SIZE=3D2><cfset =
temp =3D QuerySetCell(mail,"MailTo",ListGetAt(thisLine, =
1))> =
</FONT>
<BR> =
=
<FONT SIZE=3D2><cfset =
temp =3D QuerySetCell(mail,"FName",ListGetAt(thisLine, =
2))></FONT>
<BR> =
=
<FONT SIZE=3D2><cfset =
temp =3D QuerySetCell(mail,"LName",ListGetAt(thisLine, =
3))></FONT>
<BR> <FONT SIZE=3D2> =
<cfset counter =3D IncrementValue(counter)></FONT>
<BR> <FONT =
SIZE=3D2></cfloop></FONT>
<BR> <FONT =
SIZE=3D2></cfif></FONT>
<BR><FONT SIZE=3D2><cfcatch type=3D"any"></FONT>
<BR> <FONT =
SIZE=3D2><cfabort showerror=3D"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#"></FONT></P>
<P><FONT SIZE=3D2></cfcatch></FONT>
<BR><FONT SIZE=3D2></cftry> </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 </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