CFHeader to set the content-disposition file name does not

Hello


We have the code that creates a workbook with the POI library and then using CFHeader to set name of file with content-disposition, as shown in the code below. After making the content available, we write the Excel workbook in the browser. The code is below.


This works perfectly in CF 9 but when we went to SEE 11 we found it doesn't work anymore. The same code works fine in CF 9 but not in CF 11. The file name is ignored and the file is now given the name of the cfm script is called with the correct xls extension.


Any suggestions as to what is the cause for CF not CF 9 11 would be appreciated.


Code:

< name cfheader = "Content-Disposition" value = "seizure; filename = "#arguments. "FileName #" ">"

< cfscript >

Write the workbook in the ByteArrayOutputStream to get the ContentLength

local.workBook.write (local.outStream);

local. Len = arrayLen (local.outStream.toByteArray ());

local.outStream.flush ();

local.outStream.close ();

Working now on the display of the browser output stream

local. Context = getPageContext();

local.context.setFlushOutput (false);

Calling the getResponse twice (2nd getResponse) method gets the binary response of the character response (1st getResponse)

local. Response = local.context.getResponse (m:System.NET.FtpWebRequest.GetResponse ());

retrieve the output stream from the response to the browser.

local.out = local.response.getOutputStream ();

local. Response.Reset ();

Set the content type and the contentLength

If the two are not provided, then the data will be displayed not correctly

local.response.setContentType("application/vnd.ms-excel");

local.response.setContentLength (local.len);

write the workbook in the binary output of http response stream

local.workBook.write (local.out);

clean things up and close the output stream

local.out.Flush ();

local.response.flushBuffer ();

local.out.Close ();

< / cfscript >

Kind regards

Leslie

I found the problem. He is not related to the use of the POI library to all. Also we are migrating to CF 11 currently and just try to get things migrated as is. After our migration, we will look at CFSpreadsheet to see if it can meet the demand of our users formatting now.

It seems that the call to local.response.reset () in CF 11 now clears the response properties, including the elements of headers. CF 9, he should not have deleted them as background. By setting the Content-Disposition response header after this point, the value was available for the browser to use.

If the default file for a generated file name must be the name of the script creating the name of the file followed by the file appropriate for the file extension.

The updated code is below, note the lines of code in bold.

Write the workbook in the ByteArrayOutputStream to get the ContentLength

local.workBook.write (local.outStream);

local. Len = arrayLen (local.outStream.toByteArray ());

local.outStream.flush ();

local.outStream.close ();

Working now on the display of the browser output stream

local. Context = getPageContext();

local.context.setFlushOutput (false);

Calling the getResponse twice (2nd getResponse) method gets the binary response of the character response (1st getResponse)

local. Response = local.context.getResponse (m:System.NET.FtpWebRequest.GetResponse ());

retrieve the output stream from the response to the browser.

local.out = local.response.getOutputStream ();

  local. Response.Reset ();

Send the browser the good content-disposition header

local.resp = local.context.getResponse ();

local.resp.setHeader (("string", "Content-Disposition") javacast, javacast ("string", "001438.EPS nt;filename=#arguments.fileName#")); "))

Set the content type and the contentLength

If the two are not provided, then the data will be displayed not correctly

local.response.setContentType("application/vnd.ms-excel");

local.response.setContentLength (local.len);

write the workbook in the binary output of http response stream

local.workBook.write (local.out);

clean things up and close the output stream

local.out.Flush ();

local.response.flushBuffer ();

local.out.Close ();

Tags: ColdFusion

Similar Questions

  • In Mac Mail the contents of my email does not appear on the right side in mac maila

    In Mac Mail the contents of my email does not appear on the right side as it should. I checked all the settings, anyone ever had this problem before and going to knowwhat?

    Please, back up all data. Rebuild the mailbox.

  • The temporary internet files folder does not show all the files in this folder property while is more than 1 GB. How to delete temporary internet files. ?

    The temporary internet files folder does not show all the files in this folder property while is more than 1 GB. How to delete temporary internet files. ?  Disk space is very low around 1 & half GB. Please someone help resolve this issue. I am looking for the solution, but it did not have a specific.

    Thank you best regards &.

    Atul Zade.

    CCleaner is very useful to get rid of temporary files, you can get it here: http://www.piriform.com/ccleaner you can use it to clean your temporary files, but DO NOT use registry cleaning works, registry cleaning is mainly a useless effort that can cause more harm than good.

    John

  • In the menu "arrange by" name does not sort by alpha?

    In the menu for columns ' represented by ' name does not sort by alpha?

    In what app?

    How to get arranged?

    A screen shot after that reorganization would be useful. Be sure just what block you personal information

  • Application file name does not change

    After I go to BUILD > CONFIGURATION > MANAGE CONFIGURATION > RELEASE > EDIT > TARGET SETTINGS, then type a new name in the APPLICATION FILE field, or actually browse and select the file I wanted he call to, and select OK > DONE > DONE. It does not change.

    Worm 2010

    Have you tried to give him directly into the Build > parameter control targets, by selecting the Release configuration, by typing the name? I always do this way and the name actually changes.

  • The module "Adobe layer Namer" does not appear in the extensions.

    Hi all.

    I use PS cc 2015.

    Well the module "Adobe layer Namer" appear to have correctly installed and appears on my Adobe add-on page, it does not appear under window > Extensions.

    Please notify.

    Thank you

    Dario.

    Did you try to remove and reinstall add on?

    Please disconnect from creative cloud app and then reconnect.

    Concerning

    Jitendra

  • How to fix: after upgrade to 31.1, using the list of group name does not, gives the messages this name "is not a valid email address."

    Before the upgrade, I often type in the group alias in the address box, and fills the name of the group. But now when I try to send the message, I get an error that the name that appears "is not a valid email address" and then details how to train the appropriate addresses.

    I deleted the list of my address book personal and recreated to address in my CAP, but the error persists. I have to manually add individual addresses.

    I tried selecting the group from the list in the Contacts pane instead of typing the alias, no change.

    I'm doing something wrong?

    -Mike

    I have new information on this subject.

    It looks like this bug. If you have a Bugzilla account, it would be useful to vote for this issue.

    It seems that lists with a description that includes several words have this problem. The bug report suggests to replace whites "" between the words in the descriptions of these lists with an underscore "_".

    If you don't want to change your descriptions, the other workaround provided still works.

  • 'Forward' to move to the next audio file button does not work with audio books.

    Hi all

    My first problem I can't understand mine. I did a search through old messages using several key words and couldn't find it.

    -Sansa Fuze worm-1...

    -New firmware dated 12/27/09

    Mode - MSC

    I buy the audio book CD and then extract them to MP3 so I can listen to on the "rocket". I put all the MP3 of the book in a directory, use Mp3tag to put in place a track number, title, author, and such then I drag the folder to the folder "audiobook" on the "rocket".

    I start to play the first file, and most things work very well. The documents in the file and I cannot FF or REW in this file. When this file is complete, the "rocket" ahead to the next file of its own. Bookmarking works fine. When I try to use the 'next' button to move to the next file, however, nothing happens. If I try to use the 'back' button to go to the previous file, nothing happens. Very strange.

    The button works fine when I'm listening to MP3 music. I can jump forward or backward through the tracks normally. It is the same with podcasts.

    I don't normally jump before the audio book titles, but sometimes I'll do it if I lose interest in the book and hope to find something more interesting on a next track.

    Thanks in advance for any help with this one.

    See you soon.

    Generic audio books works a little bit differently from the Audible.  New audio book functionality, allowing any type of playable, always has the option of cool chapter mode, but it functiond otherwise than by playing an Audible book.

    Sound files have chapter breaks that can be selected in the part of the main work.  "Regular" audio books have just chapter-titles.  Try to select the chapter mode; It affects to jump between tracks.

    Bob

  • XP Cd rom error message, code 19. CD rom icon does not appear in the 'my computer' file and does not read the CD.

    Hello, I have tried everything to fix this problem and nothing has worked. I removed the cd-rom drive and reinstalled, I open my registry and remove the filters above and below the exact file, what I was told. I don't know what else to do, nothing is solved the problem. Please help me, I really need to use my Cd-rom for school assignments.

    XP forums:

    http://social.answers.Microsoft.com/forums/en-us/category/WindowsXP

    Link above is for XP Forums.

    There is a list of the different Forums XP to the link above to help you.

    You get the help you need there.

    Here is the Vista Forums.

    See you soon

    Mick Murphy - Microsoft partner

  • Course VI Path returns the location of the original source file, exe does not.

    LV-2010 running.

    I have a VI that opens a PDF style manual when the user clicks a button.  My development project is configured with a project folder main and 3 subfolders called Source, Application and install.  Of course, the source code is in the Source folder.  I also have a copy of the manual for the Application with the application.

    When operating, the VI uses object traced the current VI as starting point for where is the manual.  Current path of the VI includes the Source folder in the path that it generates.  This is not a problem when you run the source code, like the VI is running in this folder.  Problem is that the Source folder is also included in the path generated running on the target computer running the exe.  There is no Source folder on the target computer, so I am at a loss to explain why this is happening.  It's probably a parameter in the constructor of my application, but I can't.  Never had this problem before.  Can anyone help?  Thank you.

    Start reading here.

  • Is it possible to sort the images by file name?

    I imported a record of 200 images in Photos for OS X (El Captain). Image files have been appointed in the order - I want them to appear in a slide show: photo_01, photo_02 etc...

    Once I imported the images - I found them all out of order - and the only options I can find in the view menu are somehow 'oldest first', 'newest first' or ' title '. Please, someone tell me I'm missing something obvious - he and not that Apple chose to omit the possibility to sort the images by name? If this is the case - I'm speechless - how is f - ing stupid!

    Sort by file name is not an option in the Photos. Albums and smart albums you yourself set can be sorted by name, date of capture, or manually.

    Sorting through the predefined albums is automatic:

    • 'Photos' display with moments and collections is sorted by date of capture and the location.
    • 'All the Photos' display is sorted by the date of the import session.
    • Other built-in smart albums are sorted by the date of capture.

    You can see the current sort order, preset, if it is grayed out in the "view > sort ' menu.

    As a workaround:

    1. If you need to want pictures to be sorted by file name, copy the name of the file in the title field. Then, create a smart album of the items and sort by title. We have posted a trick to copy the name of the file in the title field for the selected photos: Script: change the title filename without Extensionor: Script: batch change the titles of the Extension/w
    2. Or view your photo library in pictures of power.  This versatile tool lets you browse photos as a list or thumbnail while looking the other metadata under the thumbnails or displayed as list with columns selected and sorted by columns.

    You can do a lot with the free trial: download PowerPhotos here: Fat Cat Software-PowerPhotos

  • How can I get the 8.3 file name short AND way?

    We use some old DOS programs and need to use the old format back (filename.xxx). When the files are in the long trees, it is very difficult to find the names of files under Windows.

    There was a response published in Google (http://answers.google.com/answers/threadview/id/522710.html) which works very well under XP, but when I use it in Windows 7, I get the long file name.

    Does anyone know how to do this?  The program can be changed?  Here is the program of this flajason-ga posted, but it must be updated for Windows 7 (I only know how to program in Foxpro).  Thank you, Alan

    Topic: Re: how to get the 8.3 file name short AND path?
    From: flajason-ga on May 27, 2005 10:45 PDT
     

    After my last comment, I read your details a little closer.
    The last script I posted was to list out a whole directory in 8.3 format.
    If you are looking for a friendly way of Clipboard to recover the 8.3
    for individual files, that will be more to your liking.

    Same thing as before. Copy the below into Notepad and save it with a .vbs extension.
    Except that this time, you can simply drag and drop a folder or file icon
    on the .vbs file and it displays the short path in an input box.
    where you can copy the value and use anything you want to.

    If you're industrious, you can also save the .vbs file in your
    Folder "send to" (C:\Documents and Settings\ [yourname] \SendTo) to have
    It is available in your context menu with a right click.

    Set fso = CreateObject ("Scripting.FileSystemObject")

    ' Is a file or a folder?
    If fso. FolderExists (WScript.Arguments (0)) then
    "It's a folder
    Set objFolder = fso. GetFolder (WScript.Arguments (0))
    Refund = InputBox ("this is your short path:", "SHORT PATH", objFolder.ShortPath)
    End If

    If fso. FileExists (WScript.Arguments (0)) then
    "It's a file
    Set objFile = fso. GetFile (WScript.Arguments (0))
    Refund = InputBox ("this is your short path:", "SHORT PATH", objFile.ShortPath)
    End If

    Hello

    Read the following article.

    How Windows generates 8.3 names to long file names
    http://support.Microsoft.com/kb/142982

  • The browser Safari windows:-export Japanese character of file name are not displayed

    I am facing a problem on windows 7 safari browser.

    When I export the pdf file, the Japanese characters in the file name are not displayed.

    Hello

    Apple did not support Safari for Windows for years is not surprising that you have problems.

    Use Chrome or Firefox.

  • To sort the list of files by time not the file name.

    Original title: created the new toolbar on the sort option for changing the taskbar.

    I created a new toolbar on the taskbar, and it is directed to a folder in my network. When I click the new button on the toolbar, it opens subfolders sorted by filemane. Then, open the sufolders with files sorted by filemane.

    I want to sort the list of files per hour not the file name. is it possible to change this?

    Here's what I did.

    I right click on the taskbar - selected toolbars - selected new toolbar - selected the folder on my network.

    When I click the double chevron right the new toolbar button, it opens the files in this folder, and then I select a subfolder and an another subfolder then the individual wave in this final folder files. There are more than 300 wave files in this folder. It sorts thenm by file name which is a randomly assigned file name by the used recording software. I want to sort the files by time instead of file name. is this possible?

    Hi Jeffrey,.

    How many computers are present in the network?

    You can follow this link & check id the issue persists:

    How to arrange files using folder views in Windows XP?

    Reference: The order of sorting files and folders whose names contain numerals is different in Windows Vista, Windows XP and Windows Server 2003, in Windows 2000

    Hope the helps of information.

  • Windows 7: delete the file - the specified file name is not valid or too long

    Hi I'm trying to delete some files in vain.  I have two types of error messages.

    (1) could not find this file. It is no longer in C:\Users\...
    Check the location and try again.

    (2) the name that you specified is invalid or too long. Specify a different file name.

    There are 7 files in total.  All these files are left by an old Ubuntu experience.   Some of the files were zero kb, but most are non-zero(but small).  Five files are I think printer drivers that end in .Act.  The other two files are in different directories (no KB file) and are called the same thing, "template.desc."

    I tried to go through the forums, but I couldn't understand it.  Thanks in advance to anyone who can help you.

    Andy

    The only way to remove it is the old way of BACK. Seems the info NTFS, files are broken, but the BACK is always very good.

    I had them and it worked:
    1) open to the high command prompt (CMD)
    Type cd 2) then the location of the file (in my case
    c:\users\james\desktop)
    type dir/x 3)
    (4) next to the file to delete, it will tell the 8.3 file name
    (e.g. HEDI ~ 1).
    (5) type del then 8.3 file name (e.g. HEDI ~ 1).

Maybe you are looking for