Hey guys I'm trying to upload a text file to the DB
How do you tell CF to ignore the first 4 rows?
This is file information and shouldnt be put into the DB.
Thanks

I have...

<cfif isDefined('form.filename')>
     <cffile action="upload" destination="#expandPath('.')#"
filefield="filename" nameconflict="makeunique">
     <cffile action="read" file="#expandpath(cffile.ServerFile)#"
variable="fileData">
     <cfloop index="record" list="#fileData#" delimiters="#chr(10)##chr(13)#">
          <cfquery name="qryInsert" datasource="whatever">
          INSERT INTO chansweep (sweep_id, tx_pwr)
          VALUES (
               <cfqueryparam value="#listgetat(record,1,chr(9))#"
cfsqltype="cf_sql_numeric">,
               <cfqueryparam value="#listgetat(record,2,chr(9))#"
cfsqltype="cf_sql_numeric">
          )
          </cfquery>
     </cfloop>
     Data inserted into the database!!
<cfelse>
     <form name="frmData" method="post" enctype="multipart/form-data">
          <input type="file" name="filename"><br />
          <input type="submit">
     </form>
</cfif>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Protect your mail server with built in anti-virus protection. It's not only good for 
you, it's good for everybody.
http://www.houseoffusion.com/banners/view.cfm?bannerid=39

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183200
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to