• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can I make the browser use the proper filename during a forced save, using CFCONTENT/CFHEADER

Engaged ,
Feb 27, 2015 Feb 27, 2015

Copy link to clipboard

Copied

We have a client using CF8 Server for a site and I am using the CFHEADER/CFCONTENT method to force a file to save to the end-user's computer.

The dialogue comes up as expected, but regardless of what is found in the CFHEADER for a filename, it tries to save the file as the CFM page name.

i.e. The CFM page is signature.cfm. I am trying to make it save a TXT file to the user's computer, which it seems to be trying to do, but the instead of using "sig.txt" as the filename as outlined in the CFHEADER, it is defaulting to "signature.cfm"

While I know that I could change the name and extension and the content in the file would be correct, the mass majority of end-users will not know that they can do that, and the client does not want it to become more complicated than necessary.

Is there a way to make the file change to the proper name in the SAVE AS dialogue?

Thanks in advance.

Code so far is pretty straight forward ...

<CFHEADER name="Content-Disposition" value="attachment; filename=sig.txt">

<CFCONTENT type="application/unknown" file="#xf#">

Views

254

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 27, 2015 Feb 27, 2015

Copy link to clipboard

Copied

LATEST

I'm guessing the type="application/unknown" is interfering. Try type="text/plain".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation