Download class roster to scanner [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => rickowen [ip] => rickowen@yahoo. [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> cfcontent -- file opens in browser rather than download - Coldfusion - Advanced Techniques

cfcontent -- file opens in browser rather than download - Coldfusion - Advanced Techniques

The following code is supposed to generate a small text file that I want to download to the user's system where another program will load it into a small handheld sanning device. However, instead of prompting the user to save the file, it always just displays it in the browser window. What am I doing wrong? I've tried various combinations of 'type=".../..."' but to no avail. Any help would be very greatly appreciated: Thanks, Rick. <cfset class_code = "#url.c1#" /> <cfset course_code = "#url.c2#" /> <cfset start_date = "#url.c3#" /> <cfset start_time = "#url.c4#" /> <cfset duration = "#url.c5#" /> ...

Sponsored Links
  1. #1

    Default cfcontent -- file opens in browser rather than download

    The following code is supposed to generate a small text file that I want to
    download to the user's system where another program will load it into a small
    handheld sanning device. However, instead of prompting the user to save the
    file, it always just displays it in the browser window. What am I doing wrong?
    I've tried various combinations of 'type=".../..."' but to no avail. Any help
    would be very greatly appreciated:

    Thanks,
    Rick.


    <cfset class_code = "#url.c1#" />
    <cfset course_code = "#url.c2#" />
    <cfset start_date = "#url.c3#" />
    <cfset start_time = "#url.c4#" />
    <cfset duration = "#url.c5#" />
    <cfset instr_snum = "#url.c6#" />
    <!--- lock is a preset parameter that indicates no attendees have been
    assigned to the class --->
    <cfset lock = "0">
    <cfset fn='e:\temp\' & class_code & '.txt' />
    <cfoutput>
    <cffile
    action = "write"
    file = "#fn#"
    addNewLine="no"

    output="#class_code#,#course_code#,#start_date#,#s tart_time#,#duration#,#instr_s
    num#,#lock#" />
    <html>
    <head>
    <title>Download class roster to scanner</title>
    </head>
    <body>
    <cfheader name="content-disposition"
    value="inline;filename=#class_code#.txt"><cfconten t type="text/text"
    file="#fn#" deleteFile="Yes" />
    </body>
    </html>
    </cfoutput>

    Sponsored Links
    rickowen Guest

  2. #2

    Default Re: cfcontent -- file opens in browser rather thandownload

    Change the cfcontent to an 'unknown' type, you should get a dialog box asking what to do with the file.
    coderWil Guest

  3. #3

    Default Re: cfcontent -- file opens in browser rather thandownload

    cffile writes to the server not to the client machine.

    either I'm blind, or your code does not have a cfcontent tag (don't rule out
    the blind part)

    Originally posted by: rickowen
    The following code is supposed to generate a small text file that I want to
    download to the user's system where another program will load it into a small
    handheld sanning device. However, instead of prompting the user to save the
    file, it always just displays it in the browser window. What am I doing wrong?
    I've tried various combinations of 'type=".../..."' but to no avail. Any help
    would be very greatly appreciated:

    Thanks,
    Rick.




    Dan Guest

  4. #4

    Default Re: cfcontent -- file opens in browser rather thandownload

    you could change your <cfheader> tag to attachment instead of inline.

    from this:
    <cfheader name="content-disposition" value="inline;filename=#class_code#.txt">

    to this:
    <cfheader name="content-disposition"
    value="attachment;filename=#class_code#.txt">

    that should force the browser to open a save dialog.

    Kronin555 Guest

  5. #5

    Default Re: cfcontent -- file opens in browser rather thandownload

    Ahh! the "attachment" did the trick! Thanks to all that responded.

    Rick.
    rickowen Guest

Similar Threads

  1. CFCONTENT tag is just displaying data on the browser??
    By ben@bp in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: September 23rd, 10:40 PM
  2. download window opens twice
    By JHCOLVI in forum Macromedia ColdFusion
    Replies: 2
    Last Post: June 23rd, 08:02 PM
  3. cfcontent ,cfheader download
    By prashantroy in forum Macromedia ColdFusion
    Replies: 1
    Last Post: May 12th, 11:41 AM
  4. when PDF file opens in browser (IE 6.0), no toolbars appear
    By Bill_G._Carson@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 6
    Last Post: June 1st, 02:32 PM
  5. Browser wants to do a file download on a CGI script
    By Ron Goral in forum PERL Beginners
    Replies: 8
    Last Post: September 14th, 08:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •