Create Files on the Fly in ColdFusion
page 5 of 6
by Sarita Mishra
Average Rating: 
Views (Total / Last 10 Days): 33749/ 55

Creating .XML file


1) The change in the type of the file to be created in CFCONTENT TYPE tag will solve this problem. Here it is XML type.

<CFHEADER NAME="Content-Disposition" VALUE="INLINE; FILENAME=filename.xml">
<CFCONTENT TYPE="application/XML"  DELETEFILE="yes">

Deletefile=”yes” will delete the files from the directory after sending it to the client.  If a user wants to be prompted with an option to save the file or open it in the browser then the value="inline will solve this.

Listing 6

  <CFHEADER NAME="Content-Disposition" VALUE="INLINE; FILENAME=test.xml">
  <CFCONTENT TYPE="application/XML"  DELETEFILE="yes"> 
       <Author>Abraham Linkon</Author>
       <Price>Rupees 500</Price>

This will create an .xml file which can be opened in a browser and can be used independently in subsequent ColdFusion pages as ordinary .xml files.

View Entire Article

User Comments

Title: great   
Name: Sandy
Date: 2006-11-02 6:33:11 AM
Great job.. keep moving ahead
Title: Kar   
Name: Chandrakanta
Date: 2006-11-01 2:56:09 AM
It is very nice and can also helpful for the new developers. Come across creating different file formats at the time of requirement.
Title: Great Job   
Name: pd
Date: 2006-11-01 2:41:58 AM
Keep it up.
Title: Nice Article   
Name: Tom Anderson
Date: 2006-10-31 1:46:13 AM
Very Nice and informative article for people working on ColdFusion.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-04-19 1:56:36 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search