Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<cfif StructKeyExists(FORM, "submit")>
	<cfparam name = "FORM.skipFirst" default = "0" />
	<cffile action = "upload"
			fileField = "csv"
			destination = "#GetTempDirectory()#"
			nameConflict = "overwrite"
			accept = "text/plain, text/csv, text/comma-separated-values, application/octet-stream, application/vnd.ms-excel" />

	<cfset fileName = cffile.clientFilename />
	<cfset fileExt = cffile.clientFileExt />
	<!--- read the file line by line to avoid running out of memory --->
	<cfset filePath = "#GetTempDirectory()##fileName#.#fileExt#" />
	<cfset fileReader = CreateObject("java", "java.io.FileReader").Init(JavaCast("string", filePath)) />
	<cfset bufferedReader = CreateObject("java", "java.io.BufferedReader").Init(fileReader) />
	<cfset lineReader = CreateObject("java", "java.io.LineNumberReader" ).Init(bufferedReader) />
	<cfset request.lineData = lineReader.readLine() />
	
	<cfloop condition="StructKeyExists(request, 'lineData')">
		<cfset lineNum = lineReader.GetLineNumber() />
		<cfif form.skipFirst EQ 1 AND lineNum EQ 1>
			<!--- this is the only way I could get this to work... --->
			<cfset request.lineData = lineReader.readLine() />
		</cfif>
		<!--- after every 25 lines, clean up the garbage --->
		<cfif lineNum % 25 EQ 0>
			<cfset runtime = CreateObject("java", "java.lang.Runtime").getRuntime() />
			<cfset runtime.gc() />
		</cfif>
		<cfset vals = ListToArray(request.lineData) />
		<cfset Model.updateAttribute(URL.id, vals) />
		<cfset request.lineData = lineReader.readLine() />
 	</cfloop>
 	
		<!--- this is causing trouble
		<cffile action = "delete" file = "#GetTempDirectory()##fileName#.#fileExt#" /> --->
		<cfset flash("notice", "Your update was successful.") />
        <cflocation url = "?page=#URL.page#&action=browse&id=#URL.id#" />
</cfif>