Downloading file not the correct contents

Hi,
I have a link on another page the take me over to the page that contains the code below:
<CFOUTPUT>
<CFSET FPATH = #GetDirectoryFromPath(ExpandPath("*.*"))#>
<cfdirectory directory="#FPATH#" name="FILES" action="LIST">
<TABLE>
<CFLOOP Query="FILES">
<TR><TD>
<CFIF #FILES.NAME# EQ "test.cfm">
<A href="#FILES.NAME#"> #FILES.NAME# 
<cfheader name="Content-Disposition" value="attachment;filename=#FILES.NAME#">
</A>
</CFIF>
</TD>
</TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>
When I select the test.cfm link, a dialog box appears asking to either Save or Open the file.
The issue is the file, test.cfm, contents is not what is being saved or displayed when Open is selected.
Is there something I'm missing?
Thanks,
Mike

I am trying to download a text file, not a cfm file.
Mike

Similar Messages

  • ADF--Re-opening Download does not deliver correct content.

    I am using JDeveloper 11.1.1.4 and having an issue with downloading files. The first time a user clicks on the command link, the file opens fine. If the user closes the application that the file opened in, and clicks the same link to re-open the file (in this case a PDF) they get an error from Adobe saying the downloaded file is not a supported file type or because the file has been damaged. It seems that it doesn't read all the file. I am using code similar to other posts I've found on this discussion forum. I am adding my java code below, and the Weblogic Server Log messages, and would appreciate any good advice to resolve this issue.
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.servlet.http.HttpServletResponse;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.jbo.Row;
    import oracle.jbo.ViewObject;
    import oracle.jbo.domain.BlobDomain;
    public class Download {
        public Download() {
            super();
        public void downloadFile(FacesContext facesContext,
                                 OutputStream outputStream) throws IOException {
            String mime = null;
            ExternalContext extContext = facesContext.getExternalContext();
            DCBindingContainer dc =
                (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            System.out.println("Before getting iterator");
            DCIteratorBinding iter =
                dc.findIteratorBinding("hot_biz_docs_view1Iterator");
            ViewObject vo = iter.getViewObject();
            Row r = vo.getCurrentRow();
            BlobDomain bDomain = (BlobDomain)r.getAttribute("Document");
            String file = r.getAttribute("FileName").toString();
            String ext = file.toLowerCase();
            System.out.println("In MimeTypes:" + ext);
            if (ext.endsWith(".pdf")) {
                mime = "application/PDF";
            } else if (ext.endsWith(".doc")) {
                mime = "application/msword";
            } else if (ext.endsWith(".docx")) {
                mime =
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            } else if (ext.endsWith(".xls")) {
                mime = "application/vnd.ms-excel";
            } else if (ext.endsWith(".xls")) {
                mime =
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            } else if (ext.endsWith(".txt")) {
                mime = "text/plain";
            } else if (ext.endsWith(".ppt")) {
                mime = "application/vnd.ms-powerpoint";
            } else if (ext.endsWith(".rar")) {
                mime = "application/octet-stream";
            } else if (ext.endsWith(".zip")) {
                mime = "application/zip";
            } else if (ext.endsWith(".jpg")) {
                mime = "image/jpeg";
            Long length = bDomain.getLength();
            HttpServletResponse response =
                (HttpServletResponse)extContext.getResponse();
            response.setHeader("Content-Disposition",
                               "attachment;filename=\"" + file + "\"");
            response.setContentLength((int)length.intValue());
            System.out.println(mime);
            response.setContentType(mime);
            InputStream in = null;
            try {
                in = bDomain.getBinaryStream();
                outputStream = response.getOutputStream();
                byte[] buf = new byte[1024];
                int count;
                while ((count = in.read(buf)) >= 0) {
                    outputStream.write(buf, 0, count);
                    if (count <= 0) {
                        System.out.println("End if while loop");
                        break;
            } catch (IOException ex) {
                System.out.println(ex.getMessage());
                ex.printStackTrace();
            in.close();
            outputStream.flush();
            outputStream.close();
            response.flushBuffer();
            facesContext.responseComplete();
            System.out.println("closed and responseComplete");
        }<Aug 22, 2011 4:11:11 PM CDT> <Error> <HTTP> <BEA-101083> <Connection failure.
    java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '3544' bytes.
         at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:446)
         at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1432)
         at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1511)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1462)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         Truncated. see log file for complete stacktrace
    >
    <Aug 22, 2011 4:11:11 PM CDT> <Error> <HTTP> <BEA-101104> <Servlet execution in servlet context "ServletContext@33250642[app:LIB_Test module:LIB_Test-LibTestVC-context-root path:/LIB_Test-LibTestVC-context-root spec-version:2.5]" failed, java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '3544' bytes..
    java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '3544' bytes.
         at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:446)
         at weblogic.servlet.internal.ServletResponseImpl.ensureContentLength(ServletResponseImpl.java:1432)
         at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1511)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1462)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         Truncated. see log file for complete stacktrace
    >

    You need to close the blob stream, otherwise you can't read it again.
    Use the blob.closeInputStream() method on your blob.
    Timo

  • Download File not opening correctly in Firefox... (Works fine in IE...)

    Running the following code snippet in Oracle 11.2, APEX 4.2.3, IE 10, Firefox 24:
    procedure download_to_user
    is   
    t_excel blob;
    t_filename varchar2(200);
      begin
      t_excel := finish;
      t_filename := 'test.xlsx';
       htp.flush;
       owa_util.mime_header( 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', false );
       htp.print( 'Content-Length: ' || dbms_lob.getlength( t_excel ) );
      htp.print( 'Content-disposition: attachment; filename=' || t_filename || ';' );
      htp.print( 'Content-Description: Generated by as_xslx' );
      owa_util.http_header_close;
      wpg_docload.download_file( t_excel );
      apex_debug_message.log_message( 'done' );
      end;
    Now the strange part.. It works fine in IE & Chrome when I have it called from a button click on a form, when I try it in Firefox, it returns a garbled file that Firefox thinks IT Should open...  I would think since all the issues we seem to have with IE that this would be the opposite..
    Thank you,
    Tony Miller
    LuvMuffin Software

    Hi TexasApexDeveloper,
    I don't have IE10 to test this with but I find it strange that you don't need to add   
    APEX_APPLICATION.stop_apex_engine;
    or
    APEX_APPLICATION.g_unrecoverable_error := TRUE;
    at the end of your code, to stop possible branches or further rendering.
    That's the only thing in your code that I can see that can indicate an error. Can you create an example on apex.oracle.com if that does not help?
    Regards,
    Joni

  • Can't download files -even the support center's remote login appl won't download;  web sites like USA Today will not open; etc.

    This all started by certain sites not opening, like USA Today; Intellicast.com.  Installed Maverics yesterday successfully and the web sites very briefly worked and then starting failing again.  Called tech support and couldn't download their remote login code.  From Safari's viewpoint thought there might be a problem with Adobe Flash.  So deleted that and then tried to download the installer code from Adobe and that wouldn't download.  Suggestions would be appreciated.

    Firefox can find plugins in several locations, but Firefox 21 changed the location of the "shared" plugin folder so older installers like the Microsoft Windows Media Plugin no longer drop the DLL file in the correct location.
    There apparently are two ways to address this:
    (1) Change a Firefox preference so that Firefox checks the old location. Here's how:
    (i) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (ii) In the filter box, type or paste '''plugins''' and pause while the list is filtered
    (iii) Double-click '''plugins.load_appdir_plugins''' to switch its value from false to true.
    This will take effect after you restart Firefox.
    (2) Copy the plugins folder to the new location. Here's how on Win 7 64-bit:
    Open a Windows Explorer window to:
    C:\Program Files (x86)\Mozilla Firefox
    Right-click and copy the '''Plugins''' folder
    Double-click the '''browser''' folder to open it
    Right-click and paste
    Right-click the new copy of '''Plugins''' and rename it to '''plugins'''
    After restarting Firefox, the plugins in that folder should now be available.
    ''Edit: I suggest just doing #1.''

  • HELP!!!i can download files from the internet but i can not open them,help!

    I am running mac os x 10.5 i can download files from the internet but adobe reader 9 keeps telling me they can not decode them,( Adobe Reader could not open 'dap93.exe' because it is either not a supported file type or because the file has been damaged) (for example, it was sent as an email attachment and wasn't correctly decoded). help!
    Message was edited by: kjsk8n

    Adobe Reader does not open .EXE files, it opens .PDF files.  If you were on Windows I would tell you to fix the file association, but I have no idea how to do that on a Mac.

  • HT203167 I have just downloaded the latest itunes version (11.0.1). All my data cannot now be located, though the library is showing all the correct content.The data is stored on an external hard drive. How do I tell the library where to find it's data?

    I have just downloaded the latest itunes version (11.0.1). All my data cannot now be located, though the library is showing all the correct content.The data is stored on an external hard drive. How do I tell the library where to find it's data?

    The iTunes application should be installed on the system drive. You may need to repair iTunes to fix that error regarding a missing .exe.
    To organize your library properly see Make a split library portable.
    If you don't have a working version of the library that can be transformed into a portable shape I have tools and techniques that can repair the broken links.
    tt2

  • HELP....AVCHD / MPEG files not playing correctly!

    I have been trying to download video that was shot with the new Sony FS100 camera that I'm told are AVCHD or MPEG files to my older Adobe Premiere Pro 1.5 timeline, but they are not playing correctly. When I reverse the field dominance, the image plays better but the sound is strange (I was able to speed the sound to 450% and it worked better, but then the balance of the sound from the clip is lost somewhere.).
    Any suggestions to make these files play and work correctly? I tried converting them to AVI files but that showed up completely black on the timeline! Anything I've tried either affects the video or audio negatively!  I try either makes the image play or stutterThis was shot in regular SD format, NOT HD, so they should be able to play on  a standard timeline. Can anyone suggest anything to help please? Much appreciated!

    Thanks for your reply, I ran it through Media Info. Here are the results:
    Container & general information:
    MPEG-PS: 290 Mib  4min22s
    1 Video stream: MPEG video
    1 Audio stream: AC-3
    First Video Stream:
    8833 Kbps, 720*480 (4:3), at 29.970 fps, MPEG video (NTSC) (version 2) (Main@main) (Custom Matrix BVOP)
    First Audio Stream:
    256 Kpbs, 48.0 Khz, 16 bits, 2 channels, AC-3 (DVD-Video)
    Please let me know where to go from here. Thanks so much!
    Date: Fri, 11 Nov 2011 10:50:15 -0700
    From: [email protected]
    To: [email protected]
    Subject: HELP....AVCHD / MPEG files not playing correctly!
        Re: HELP....AVCHD / MPEG files not playing correctly!
        created by Ann Bens in Premiere Pro CS4 & Earlier - View the full discussion
    Welcome to the forum.A screendump of what these SD files exactly are would be very nice.Run them throught Media info.http://mediainfo.sourceforge.net/en
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4020725#4020725
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4020725#4020725. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Premiere Pro CS4 & Earlier by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • In search results, Summary sometimes shows the top of file, not the text I searched for

    I'm searching lots of html files, it's a web site that's not imported into Sharepoint. Search is returning the correct files, but about half the time the Summary contains the text at the top of the html file, not the text surrounding the text I searched
    for. It's a big problem, users have to open the file then find the search text to see if it's useful.
    If I search for 'potato' here's an example Summary which is ok:
    All pages in issue FTDA-1983-0409:
     00010002000300040005000600070008000900100011001200130014001500160017001800190020
    … today's dieticians, the potato … most of us enjoy a
    potato cooked …
    Here's a Summary just showing text from the top of the file, 'potato' is present, but lower in the file:
    0001000200030004000500060007000800090010001100120013001400150016001700180019002000210022002300240025002600270028
    … issue: date: January 19, 1980, page …
    Could anyone help me get it to consistently show the text around the search text please?

    You can't attach a screenshot to the first post that starts a thread, but you can do that in subsequent replies.
    Does this only happen on one specific website?
    Can you post a link to a publicly accessible page (i.e. no authentication or signing on required)?
    It is possible that there is a problem with that web page and that there is a clear:both CSS rule missing that causes Firefox to start the next line at the horizontal position where the previous line ended.
    If you have made changes to Advanced font settings like increasing the minimum/default font size then try the default minimum setting "none" and the default font size 16 in case the current setting is causing problems.
    *Firefox > Preferences > Content : Fonts & Colors > Advanced > Minimum Font Size (none)
    Make sure that you allow pages to choose their own fonts.
    *Firefox > Preferences > Content : Fonts & Colors > Advanced: [X] "Allow pages to choose their own fonts, instead of my selections above"

  • Unbreakable Linux error: That's not the correct Enterprise Linux CDROM

    I eagerly downloaded Unbreakable Linux (4 CDROMS) and tried to install it in a VMWARE (Workstation 5.5.1 build-19175) virtual machine.
    I choose RHEL 4.0 32bit as a base (Typical VM configuration).
    All went fine until disc 3 was asked for during install. I got a "That's not the correct Enterprise Linux CDROM" error. I tried also to mount the other ISO's but that didn't work out either.
    Frustrating.
    The mediacheck results in PASS for all 4 CD's - and they all are all recognized correctly. So I made sure I got the complete set.
    Anyone a shot...?
    Greetings Bart.

    Hey,
    You cat chack the sha1sum of you're file.
    My CD's working fine and this is the results of sha1sum :
    sha1sum /data/Oracle/V1014*
    ea069b4c7f6e58f3f11b76fc6ce07cac377951c4 /data/Oracle/V10142-01.zip
    9417a26291bf90ca047cbbf0203330b693bc9afa /data/Oracle/V10143-01.zip
    6bb69b35c00b4a6891a1c4c9a17f62177c8df7b2 /data/Oracle/V10144-01.zip
    080c9ee4ebbeedde9d7f72cde37c7eec4cfe9675 /data/Oracle/V10145-01.zip
    linux-jn6s:~ # sha1sum /data/Oracle/Enterprise-R4-U4-i386-disc*
    b1d326c2c59821bcc5ab515e5d35809121f7fb5f /data/Oracle/Enterprise-R4-U4-i386-dis c1.iso
    3e04c9c9cf7672f5b97181edaa0119778fa38486 /data/Oracle/Enterprise-R4-U4-i386-dis c2.iso
    a1012454a81203006cf4a880b5942eb6068c7bea /data/Oracle/Enterprise-R4-U4-i386-disc3.iso
    97ca9d546d2b94a664ec46dcdd9fa00791d62dc1 /data/Oracle/Enterprise-R4-U4-i386-disc4.iso
    Ofek Doron
    Penguin IT

  • In PDF to Excel conversion dates like 03/12/15 convert to Dec 3rd 2015 not the correct date of Mar 12th 2015 whereas date 03/13/2015 converts correctly as March 13th 2015

    In PDF to Excel conversion dates like 03/12/15 convert to Dec 3rd 2015 not the correct date of Mar 12th 2015 whereas date 03/13/2015 converts correctly as March 13th 2015

    Hi DirTech,
    Are both of these dates in the same Excel file? If they're in different files, are you choosing the same language for OCR (optical character recognition)?
    If they are in the same PDF file, how was that PDF file created? Was it created from a third-party application (rather than an Adobe application)? If it was created by a third-party application, it could be that it wasn't written to spec, and that's why you're seeing some oddities in the PDF > Excel conversion.  (See Will Adobe ExportPDF convert both text and form... | Adobe Community.)
    Best,
    Sara

  • Why is my .psd file not rendering correctly in ae

    Some layers of the .psd document are not rendered correctly. However they are imported.
    The strange thing is that when I first move from Photoshop to Illustrator, save it as an .ai file it is rendered properly (in Ae).
    I am kind of clueless as to what is causing this issue.
    Kind regards,
    Jelle

    Okay if more information is needed, i'll provide. However you may disregard my initial comment about illustrator. It flattens the photoshop layers so I do not have any flexibility in After Effects. In other words, my main question remains: why is my psd file not rendering correctly in ae?
    Further details:
    -photoshop cc and after effects cc.
    -macbook pro retina
    If still not clear enough, please tell me what details you are looking for furthermore

  • Ability to process several raw files with the same content but with different exposure into the single picture

    Can you add to the Lightroom an ability to process several raw files with the same content but with different exposure into the single picture?
    Base raw files can be given with exposure bracketing during shooting, for example.
    The goal - to get maximum details in darks and lights (if we use the "ligths recovery" or "fill lights" we lose the quality because raw file just have no all required information).
    The similar (but not the same, only the idea) thing - is High Dynamic Range Photography in Adobe Photoshop
    Thank you

    The plugin LR/Enfuse does this already. And of course Photomatix have a plugin available for Lightroom. This essentially amounts to pixel editing, which is beyond the range of Lightroom's metadata editing.

  • How to sign a pdf with the correct content

    how do I sign a pdf?  It says that Im not using the correct content.  And that my certificate is not valid???

    Garciaasgina which Adobe software or service is your inquiry in reference too?

  • Download files not saved

    Download files not saved. Click on download and then click on "Save", next the download window opens, but it does not show the download file?
    I recently downloaded Nero 11 and then removed. I also deleted some software Babylon, Yonno (? some name) in control panel.
    Using ZoneAlarm 10.1.101 and Firefox 10.0.2 (removed and reinstalled).

    Hello Cor-el,
    I went to Tools>Options>Privacy and it is checked off as you indicated/noted...
    I will check out the URL downloads+windows later this week...
    ZoneAlarm will not work with the latest Firefox versions 14 (or earlier ones)... so reverted to an older version of Firefox and ZoneAlarm... and it works! Aside- it is ANNOYING to click on latest version upload for Firefox and then get a screen showing what software is not compatible with that version. So I needed to remove the latest Firefox version and ZoneAlarm.. and re-install both.
    No need to use Firefox 10.0.6 ESR because I am a small home user and not a big organization?
    Thanks for your help, I will have to make the time this coming week and look into this further.
    SyBerGuy2
    P.S. The files are still not downloading and saved?

  • File not formatted correctly error

    Dear All,
    when am trying to import a contract file as excel sheet, not CVs file, i get the error ( File not formatted correctly ). any advice?

    the issue with date formatting would be corrected in Excel. When an export file that includes dates is opened in Excel, they get reformatted by the Excel program. In my experience, I have had to reformat those cells in Excel to the YYYY-MM-DD format and save the Excel file before I could import again into CM. But, if you are just exporting and then importing without opening the file in Excel, then the dates are not the problem. What are you exporting from CM? Are you trying to import into a different project or database than you exported from?

Maybe you are looking for