Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<!--- Upload the file --->
<cffile action="upload"
filefield="theFileFormfield"
destination="C:\path\to\your\webroot\fileuploads"
nameconflict="makeUnique"
accept="text/plain">
<!--- Read the File using cfhttp --->
<!--- Obviously you will want to adjust the values of text qualifier, firstRowAsHeaders and Columns as you see fit --->
<!--- Look at the live docs page if you are unsure of the attribute meanings --->
<!--- [URL unfurl="true"]http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000272.htm#1632966[/URL] --->
<cfhttp url="[URL unfurl="true"]http://www.yourdomain.com/fileuploads/#cffile.ServerFile#"[/URL]
name="qryNewFileContents"
delimiter="|"
textqualifier="'"
firstRowAsHeaders="no"
columns="COL1,COL2,COL3"></cfhttp>
<!--- Perform a Query of Queries (QoQ) to extract distinct rows from the query --->
<cfquery name="qryOnlyDistincts" dbtype="query">
SELECT DISTINCT( COL1 ) AS distinctCol, COL2, COL3
FROM qryNewFileContents
ORDER BY COL1, COL2, COL3
</cfquery>
<!--- Write the contents of your query out to a new file, using the .csv file extentsion --->
<!--- If the file that you are writing is large, you might want to use a StringBuffer instead of the 'normal' --->
<!--- cfset, however for this example I will keep it simple. --->
<cfset newFileContents = "">
<cfset newDelim = "|">
<cfset endLine = chr(10) & chr(13)>
<cfloop query="qryOnlyDistincts">
<cfset newFileConents = newFileContents & delim & distinctCol & delim & COL2 & delim & COL3 >
<!--- Add a newline unless it's the last record in the query --->
<cfif currentRow NEQ recordCount>
<cfset newFileContents = newFileContents & endLine >
</cfif>
</cfloop>
<!--- Using the name of the uploaded file, tack on the csv file extention --->
<cffile action="write" file="C:\path\to\new\file\location\#cffile.clientFileName#.csv" output="#newFileContents#">
Invalid CFML construct found on line 45 at column 92.
ColdFusion was looking at the following text:
Name
The CFML compiler was processing:
a cfset tag beginning on line 45, column 6.
a cfset tag beginning on line 45, column 6.
The error occurred in C:\Inetpub\[URL unfurl="true"]wwwroot\Bennington_LM\admin\fileuploader2.cfm:[/URL] line 45
43 :
44 : <cfloop query="qryOnlyDistincts">
45 : <cfset newFileConents = newFileContents & delim & email & delim & Date & delim & First Name & delim & Last Name & delim & Lead Type & delim & Address & delim & Address2 & delim & City & delim & State & delim & Country & delim & Zip Code & delim & Phone & delim & Purchase Time & delim & Boat Owner & delim & Owned Categories & delim & Interested Categories>
46 : <!--- Add a newline unless it's the last record in the query --->
47 : <cfif currentRow NEQ recordCount>
<cfloop query="qryOnlyDistincts">
<cfset newFileConents = newFileContents & delim & email & delim & Date & delim & First Name & delim & Last Name & delim & Lead Type & delim & Address & delim & Address2 & delim & City & delim & State & delim & Country & delim & Zip Code & delim & Phone & delim & Purchase Time & delim & Boat Owner & delim & Owned Categories & delim & Interested Categories>
<!--- Add a newline unless it's the last record in the query --->
<cfif currentRow NEQ recordCount>
<cfset newFileContents = newFileContents & endLine >
</cfif>
</cfloop>
45 : <cfset newFileCon[COLOR=red]t[/color]ents = newFileContents & delim
<cfset newFileConents = newFileContents & delim & email & delim & Date & delim & FirstName & delim & LastName & delim & LeadType & delim & Address & delim & Address2 & delim & City & delim & State & delim & Country & delim & ZipCode & delim & Phone & delim & PurchaseTime & delim & BoatOwner & delim & OwnedCategories & delim & InterestedCategories>
Invalid CFML construct found on line 40 at column 46.
ColdFusion was looking at the following text:
,
The CFML compiler was processing:
an expression beginning with "newFileContents", on line 40, column 30.This message is usually caused by a problem in the expressions structure.
a cfset tag beginning on line 40, column 6.
a cfset tag beginning on line 40, column 6.
The error occurred in C:\Inetpub\[URL unfurl="true"]wwwroot\Bennington_LM\admin\fileuploader2.cfm:[/URL] line 40
38 :
39 : <cfloop query="qryOnlyDistincts">
40 : <cfset newFileContents = newFileContents&,&email&,&Date&,&FirstName&,&LastName&,&LeadType&,&Address&,&Address2&,&City&,&State&,&Country&,&ZipCode&,&Phone&,&PurchaseTime&,&BoatOwner&,&OwnedCategories&,&InterestedCategories>
41 : <!--- Add a newline unless it's the last record in the query --->
42 : <cfif currentRow NEQ recordCount>