ColdFusion: Upload a pipe delimited file and insert into SQL table
There have be many times that I have had a project where the client has a list of records that will be used for some type of web application. Could be email blasts, or just to update a database with new records. I could also be picking up a pipe delimited file from a ftp location, that needs to be inserted into a database. The following code will provide the steps for the upload and insertion of the pipe file into a Microsoft SQL table.
// function for uploading the file from a standard web form that the user submits
<CFFILE ACTION="upload" FILEFIELD="FileContents" DESTINATION="d:\file location\" NAMECONFLICT="overwrite" >
// step for reading the pipe delimited file and begin the process
// loop through the file and insert each record
<cfquery name="importfile" datasource="datasource">
INSERT INTO EMLOYEE
Some Other ColdFusion Articles
- Adobe Coldfusion Tip For Finding Duplicate Records In SQL Database
- Coldfusion: allowing max file size when uploading
- ColdFusion: Monitor Hard Drive Space And Email Alert
- Coldfusion SQL Tips: Creating Tables, Backup, Fields
- Coldfusion Programming: Accessing a shared network drive
- Coldfusion: Encrypting and Decrypting Data
- Adobe Coldfusion Help: Query To Spreadsheet
- ColdFusion: Upload a pipe delimited file and insert into SQL table
- Coldfusion programming: How to submit muliple records at the same time that have the same field name
- How To Upload Multiple Files With ColdFusion
More by this Author
Firearms can be a very dangerous tool in the hands of the wrong person. Every state has their own gun laws and regulations. For the state of Georgia, the laws are pretty straight forward and easy to abide by. Before you...
Until this year, the only time that I've had mice or rats in the house were when my daughter had pet mice and rats, and one of those times we did have one loose in the house. (Science fair project got loose.) Anyway,...
You may refer to a truss as the rafter, but it's basically the skeleton of the roof, carrying the weight of the frame and supporting the walls of the building. Trusses are very important to preventing the walls from...