Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

ColdFusion does not recognize CSV files

$
0
0

I have a local ColdFusion 10 Developer version on my local machine.

I use ColdFusion to create a CSV file and save on the server and create a link using following code.

 

Browsers open the CSV file as a text file and I use right click link to save target, my Windows Explorer save a a html file.

It works on the other server using the same code.

I would like to know are there any configuration to set ColdFusion recognize CSV file format when save the target and it lets browsers know to use Excel to open CSV files.

 

  Your help and information is great appreciated,

 

   Regards,

 

   Sourises,

 

<Cfset thisPath = ExpandPath("*.*")>

     <cfset f_dir = GetDirectoryFromPath(thisPath)>

 

   <cfset f_name = "#dateformat(now(), 'mmddyy')##timeformat(now(), 'hhmm')#.csv">

   <cffile action="WRITE" file="#f_dir##f_name#"

   output="MtField1, MyField2" addnewline="Yes">

 

   <cfloop query="#myQuery#">

   <cffile action="APPEND" file="#f_dir##f_name#"

   output="#Field1#, #Field2#"  addnewline="Yes">

 

   </cfloop>

 

<cfset theLink = "MyServer/Report/" & f_name>

<cfoutput><a href="#theLink#">Here is the file</a></cfoutput>

   <br>


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>