We have a page that is generating dynamic content and format is output based on user's selection.
For example, if a user selected HTML format then, page comes as HTML page. That works fine as well as PDF format.
The challenge is, if a user selecting Excel format and we require Excel files to save to the server.
When a user selecting Excel format, the file is generating in excel just fine but, instead of saving it to the server the user is getting Save As dialog box but, as I mentioned we need the file to save to the server.
Any input is greatly appreciated. We are using CF 2016.
The code sample:
<cfsavecontent variable="Page">
<cfif CompareNoCase(FORM.format,"xls")>
<cfsetting enablecfoutputonly="Yes">
<cfheader name="Content-Disposition" value="attachment;filename=""#VARIABLES.vcFilename#""">
<cfcontent type="application/vnd.msexcel">
<cfif>
<table><tr><td><cfoutput>#somecontent#</cfoutput></td></tr>...</table>
</cfsavecontent>
<cfif CompareNoCase(FORM.format,"xls")>
<cffile
action="write"
destination="d:\somedir\"
file="#VARIABLES.vcFileName#"
output="#Page#"
nameconflict="overwrite">
<cfif>