File download problem

I am using the following code to present a file to the client to download when a report is generated. The code does what is suppose to, it presents a dialog box where the user can choose to open, save, or cancel the file download. However, when the file is downloaded it contains the client HTML at the bottom of the saved file. I checked the created file on the server and it does not contain the HTML at the bottom, so it is being added by the following jsp code when the file is presented to the user. Any help would be appreciated. BTW, this running on HP-UX 11i using oracle forms 10G.
   String RPT = request.getParameter("trig");
   String SDATE = request.getParameter("start_date");
   String EDATE = request.getParameter("end_date");
   String PRN = request.getParameter("prn");
if(RPT != null)
     try {
          Runtime rt1;
          Process proc1;
          String[] doRefresh = {"/usr/bin/sh", "-c", "/usr/local/oracle/sql/st_tags/some_script '" + SDATE + "' '" + EDATE + "' '" + PRN + "'"};
          rt1 = Runtime.getRuntime();
          proc1 = rt1.exec(doRefresh);
          int exitVal = proc1.waitFor();
       String filename="/usr/local/oracle/sql/st_tags/temp/some_file.csv";
       response.setContentType("application/octet-stream");
       String disHeader="Attachment; Filename=some_file.csv";
       response.setHeader("Content-Disposition", disHeader);
       File fileToDownload=new File(filename);
       InputStream in=null;
       ServletOutputStream outs=response.getOutputStream();
       try {
          in=new BufferedInputStream
          (new FileInputStream(fileToDownload));
          int ch;
          while((ch=in.read()) != -1) {
          outs.print((char) ch);
       finally {
          if(in != null) in.close();
       outs.flush();
       outs.close();
       in.close();
     catch (Exception ignored) {}
   }

Sorry, wasn't sure how important the HTML portion would be. Thanks for the response. Here is the HTML that is before and after the afore mentioned code.
Before:
<%@page import="java.lang.*, java.net.*, java.util.*, java.io.*"%>
<%@page pageEncoding="UTF-8" contentType="text/html;charset=windows-1252"%>
<%@page language="java" import="mil.uspfo.dpi.*" errorPage="default.jsp" %>
<jsp:useBean id="AgnosticHostBean" class="mil.uspfo.dpi.AgnosticHostBean"
scope="session">
</jsp:useBean>
<base href="http://<% out.print(AgnosticHostBean.getHostNameProperty() ); %>
:7779/j2ee/">
<html>
<head>
<title>Master Report</title>
<link rel="stylesheet" type="text/css" href="styles/uspfo.css">
</head>
<body>
<%@ include file="header.html" %>
<h1>
Master Report
</h1>
<form name="mstr_form" method="post">
<p>Start Date:<input type="date" name="start_date">(example: YYYYMMDD)</p>
<p>End Date  :<input type="date" name="end_date">(example: YYYYMMDD)</p>
<p>Payroll # :<input type="text" name="prn"></p>
<input type="SUBMIT" name="Button1" onClick="get_mstr_report()">
<input type="hidden" name="trig" size="2">
<br>
<script type="text/javascript">
function get_mstr_report() {
   document.mstr_form.trig.value="go";
</script>AFTER:
</form>
<br>
<%@ include file="footer.html" %>
</body>
</html>

Similar Messages

  • PDF Report file download problem

    Hi,
    I am using ApEx 3.1 and Oracle 10g and XSL-FO
    I have a problem in downloading a PDF file:
    (1) I have a report query (produced an xml file), report template, and report layout.
    After I linked the new PDF report into my application, when I click on the button, the PDF “File Download” popup shows only two buttons (“save” and “cancel”) with a warning message “The file you are downloading cannot be opened by the default program. It is either corrupted or it has an incorrect file type. As a security precaution, it is recommended that you cancel the download”, and the file name shows up as “f.pdf”. I am able to open the saved file (f.pdf) in Adobe Acrobat and it looks fine.
    (2) In “Home>Application Builder>Application xxx >Shared Components>Report Queries>Edit Report Query”, when I click on the “Test Report” button, the “File Download” popup shows with all three buttons, (“open”, “save”, “cancel”) --- it shows the correct name of the file, and, no warning message! At this point, the file can be opened with the “open” button”, or, be saved to the disk. The saved file opens with Adobe Acrobat and the contents are identical to that of the file “f.pdf”.
    (3) I created another application (within the same workspace) with just one page, linked the PDF report in this application, and clicked on the button, and got the same response as in (2).
    It looks like I could try to create a new application by copying page by page from the application quoted in (1), and see if that would solve the problem. It is time consuming, the outcome is uncertain, and also could create some other problems
    What could be the cause of this problem? Any alternatives? I would appreciate any help.
    Thanks
    Vasan

    We experienced the exact same problem as the OP (including corrupt files named "f.pdf" and the browser dialog box he documented). Don't know if his environment is similar, but here is how we fixed our issue:
    Our app uses an Authentication Scheme that includes under "Page Session Management" a "Session Verify Function" called like this: "return timeout_pkg.check_timeout;". This timeout_pkg I think came from code originally posted here, it works well so thanks to the original coder. However it does present a small issue in that it rewrites the mime headers in the server response in one use case. Since it is rewriting the headers to "text/html" even though we are sending back a report where the mime header should be "application/pdf", the client gets confused and the result is the symptoms the OP posted.
    So if we change the timeout package and body so the signature is like this: "function check_timeout (p_request IN VARCHAR2 DEFAULT null) return boolean;"
    And change the call in the "Session Verify Function" to pass the request as a parameter like: "return timeout_pkg.check_timeout(:REQUEST);"
    And change the body of the timeout_pkg.check_timeout function to use the correct mime type when calling a report:
    elsif not g_cookie_already_sent then
    if (p_request is not null and INSTR(p_request, 'PRINT_REPORT') != 0) then
    owa_util.mime_header('application/pdf', FALSE);
    else
         owa_util.mime_header('text/html', FALSE);
         end if;
    then we solve our particular problem... I hope this saves somebody else some time, remember this was our specific solution to the exact symptoms documented by the OP, however as a general rule I would say if you are experiencing problems with pdf printing from Apex, watch out for anything your app might be doing with the owa_util pkg in particular and mime headers in the server response in general.
    Edited by: cmcneil on Sep 5, 2008 11:45 AM
    Edited by: cmcneil on Sep 5, 2008 11:59 AM

  • Blob file download problem

    Hi Everyone,
    I can upload a microsoft word document using file browser and store it in oracle database table as a blob.
    Now when I try to display this word document. I am getting strange characters in the browser instead of a file download dialog box.
    Here is the code
    owa_util.mime_header('application/msword', false);
    htp.p('Content-Disposition: attachment; filename="test.doc"');
    owa_util.http_header_close;
    wpg_docload.download_file(lob_loc);
    I want it to popup a file download box. What am I missing?
    I tried with PDF, in IE it pops up the file download box but in Firefox, it prints the binary data in the browser.

    not sure if this is the problem, I noticed you are missing the init. This is what I use to show pdfs:
      htp.init;
      owa_util.mime_header('application/pdf',false);
      htp.print('Content-Length: ' || dbms_lob.getlength(b));
      htp.print('Content-disposition: inline; filename="pdf.pdf"');
      owa_util.http_header_close;
    wpg_docload.download_file(b);

  • .JAD/JAR file download problems

    Hi,
    I'm having trouble with downloads of .jad and .jar files through WAP onto my mobile phone. The .JAR file downloads fine via the WAP APN but then the .JAD file doesn't download.
    From what I can see, it looks like the j2me app manager on the phone which reads the jad file tries to download the .JAR file directly from the website. The problem here is that since i'm connected to a WAP APN, i have to download through the proxy so there's no direct access to the internet.
    Anyone else have this kind of problem?
    Is is possible to set up the .JAD file somehow so that it downloads through a proxy or takes the current APN to download it??
    This is a HTTPS site but I dont think that would make a difference.
    Cheers,

    Hello,
    I have a very similar problem. Not quite the same tho: i am able to download the JAD and the JAR gets requested. One some phones the JAR gets downloaded properly but on others it blocks after 50 or 60 %.
    We only encounter this problem when downloading through a proxy (defined in the phones wap/internet configuration); when we connect without a proxy everythibng works just fine.
    Another clue might be the fact that we cannot do HTTPS communication (from the device) using a connection that is proxied. (We tested by putting the file on the device using bluetooth).
    Has anybody seen this before? Do you know a solution to this problem?
    Thank you,
    Nick

  • Jar files download problems in Java Webstart with JRE 1.6

    We have encountered a few problems in Java Webstart with JRE 1.6
    In JRE 1.5, the jar files are getting downloaded onto the client
    machine with it's original names.
    Example :
    Server File Name : acm.jar
    Client File Name : RMacm.jar
    But in JRE 1.6, the jar files are getting downloaded with improper file names.
    Example :
    Server File Name : acm.jar
    Client File Name : 4fb074cc-66fc7407
    Moreover the path itself seems to be invalid.
    Example Path :
    JRE 1.5 path:
    C:\Documents and Settings\Administrator\Application
    Data\Sun\Java\Deployment\cache\javaws\https\D17.16.23.11\P443\DMtest\DMwebStart
    JRE 1.6 path:
    C:\Documents and Settings\Administrator\Application
    Data\Sun\Java\Deployment\cache\6.0\12
    Due to this, we are facing Classpath problems.
    What changes do we have to make to the code, for Java
    Webstart to work ?
    We are using JBoss 4.0.4 and JDK 1.5 in the Server
    On the client machine, we have IE 6 and JRE 1.6.01
    Help would be appreciated.

    Ask your Java Web Start question at:
    http://forum.java.sun.com/forum.jspa?forumID=38

  • Camera Raw file download problem

    Downloaded Camera RAW Images recognised in PS5 Bridge prior to download (thumbnails visible) but after download, no thumbnails visible, only icons, which when double clicked, the following error message appears "Could not complete your request because Photoshop does not recognize this type of file".
    Other previously downloaded files can be opened, and a test picture I just took, downloaded and opened up fine. Looking at the files that won't open, I noticed that the metadata is missing, so I am wondering if during the download process, the files somehow became corrupted. Can any one help with this problem please? Thanks.

    The files were the correct size after downloaded them and I used the PS5 Bridge program to dowload directly from my camera.  I have spoken to Nikon and Adobe about this problem and both seem to agree that the files became corrupted during the download process.  Nikon suggested using third party software to recover the files from the SIM card, which I have now done, but out of 120 files, there were still 6 or 8 files that I couldn't do anything with.  the strange thing is that I could view all the files with the Nikon NX2 software, but as soon as I tried to do anything with them, like converting them to a jpg, I got a meaasage saying that the file was not recognised!   So panic over for this particular issue, but I am still curious to know if this is a common problem.  I suppose if nothing else, I have learned a valuable lesson, which is not to delete pictures from the camaera until after they have been successfully transfered to the computer.  Thanks for your interest in my tail of woe!

  • Pdf file download problems

    I use the Adobe Creative Cloud file storage system to store and also share pdf files with my customers. When I need to share a pdf file, I create a link for the folder containing the correct pdf files. Then I paste the link to that folder into the body of an email that I then send to the customer. Often I will paste several different links into the same email. Normally, when a customer downloads, they simply click on the link, then they are directed to the folder contents. They then click on each individual file within the folder...on the next page there is a download drop down menu button at the left of the screen.....the dropdown menu normally give 3 or 4 options to download as: PDF, jpg, png and ease. For some reason the last week, at least 50% or more of my customers are not able to download.... they are telling me that the drop down menu does not give them the pdf option. I talked with Adobe customer support but the lady didn't seem to have the foggiest idea why this was happening or how to fix it...she said she would look into a solution and call me back but she never did. This happened about a month ago too and the problem seemed to correct itself a day or two later.... and again no one at Adobe could tell me what was up or how to fix the problem. Anyone out there experienced anything like this? Or maybe I am the only one using this service to share PDF files?

    Having the exact same problem, really frustrating. It's not working with new files I put up on the Cloud and even the files that were working previously are not downloadable as PDFs. I think Adobe has broken something…oddly when I'm logged in with my account, the download as PDF option is there, if I log out and try to get the file, then it's not there. I even tried to create another Adobe account and it's not possible to download when logged in using that account either.
    I wish that the Cloud sync and sharing worked more reliably, but it's frequently down, not working completely, not building previews etc.
    Really frustrating.

  • Jsp file download problem

    Hi,
    I am using following code in jsp.
    <%@ page session="true"%>
    <%@ page import="java.io.*" %>
    <%
    String fileName="test.txt";
    response.setContentType("application/txt");
    response.setHeader("Content-Disposition","attachment; filename="+fileName);
    try
    PrintWriter fw = response.getWriter();
    fw.write("param1");
    fw.write(",");
    fw.write("param2");
    fw.write(",");
    fw.write("param3");
    fw.write("\r\n");
    fw.flush();
    fw.close();
    catch(Exception e)
    %>
    <input type=button value="CONTINUE">
    The problem is flow does not go to CONTINUE button and it lost the control after response.setHeader("Content-Disposition","attachment; filename="+fileName);
    Do you have any idea what is the problem ?
    Thanks

    Hi
    I am trying to give user option so that he can download a file in his local machine.
    As you suggest use out object. I used the out object but i still have the same problem.
    After writig in a data.csv file, control does not go to the CONTINUE button.
    following is the sample code which i am using.
    <html>
    <body>
    <%
    String file="data.csv";
    //response.setContentType("application/vnd.ms-excel");
    response.setContentType("application/html");
    response.setHeader("Content-Disposition","attachment; filename="+file);
    try
    out.write("Test1");
    catch(Exception e)
    %>
    <div align="right">
    <input type=button value="CONTINUE">
    </div>
    </body>
    </html>
    do you have any suggestion to fix this problem?
    Kind Regards

  • Azureus file download problems....

    Hi there, im pretty new to torrents so im sorry if this is an easy problem to rectify- as i said, im pretty new to it all so bare with me...
    Ok, so i have Azureus V 3.006 (the blue frog:P)
    Anyway up in till this morning it was working fine, i would search for torrents, click download and I would get the blue frog popup telling me they had been added to my azureus downloads, and that was that. couldnt be made simpler for simpletions like me.
    So today i found a file of interest and i clicked download, no frog. Now what i get is a popup box prompting me to save this torrent (which comes up as file unknown) to a directory. Basically i end up with a file which i dont know what the hell to do with...
    I dont know why it has reverted to this instead of just adding instantly to my list.
    Any help would be most appreciated ok.
    thanks

    Do this. After you download the file open Azureus then File->Open_>Torrent File  when the menu pops up click Add Files browse to where you downloaded the file(probably on your desktop) and add it. Then click OK.   btw   /home/"username"/Desktop is where your desktop is
    Last edited by raven3x7 (2007-03-16 21:01:17)

  • Japanese file download problem

    Hi
    I am using Weblogic Server 8.1
    I have file upload/download facility in my webapplication. While trying to download file with japanese filename , file name becomes junk
    The whole code bunch is working fine with weblogic 6.1
    Any ideas ??
    Regards
    Imran

    Hi Sandra
    Please find the detailed information for your questions.
    1.Internal table content before download:During Debugging,it was observed that internal table content was same in both versions.For testing,i used only brand new data(Transaction entry).
    2.Download with code Page conversion:Yes,codepage parameter 4103 was explicitly passed into GUI_DOWNLOAD Function module.Also the front end code page which is used by system is 4110 . No errors occured.
    3.System is an Unicode system only.
    4.Actually this 6 character does not refer the byte value,only the gap between 2 fields data is getting referred in ECC 6.0.Please find the below example.
    Example - File data after Download:
    ECC 6.0: Field1            Field2      (gap - 6 characters space between 2 fields data)  Using GUI_Download
    data       u0152©Ïu201Dԍu2020      EN                               
         4.6C: Field1            Field2       (gap - 2 characters space between 2 fields data) Using WS_Download
         data    u0152©Ïu201Dԍu2020  EN    
    Note:Special characters are Japanese characters:

  • SAP Netweaver CE 7.1 File Download Problem

    Hi
    Could you please help me out with link for the CE download,since the developer studio download file seems to have got corrupted.
    I tried downloading it from the following page:-
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/907cf403-dffb-2910-2595-93635948329a [original link is broken]
    Regards
    Navneet

    Hi Rajesh,
    What is the extension of the file you downloaded? Is it tar.gz or tar? Check the downloaded file size and compare them with the actual download size. See if it matches. Also try to extract the contents of the download using WInRAR http://www.rarlab.com/rar/wrar371.exe
    Madhu

  • File downloading problem: urgent

    hai ! I want to download a attached file from mail.
    If i use the following code i can get the file but
    i can't get the content of file.
    following is my code
    try
              part = multipart.getBodyPart(aid);
              contenttype=part.getContentType();
              fileName=part.getFileName();
              byte[] bytes=fileName.getBytes();
                 response.setContentType(contenttype);
                 response.addHeader("Content-Length",Integer.toString(bytes.length) );
                         response.addHeader("Content-Disposition", "attachment;filename="+fileName);
                        ServletOutputStream out=response.getOutputStream();
            out.write(bytes);
                        catch (MessagingException e) {
               e.printStackTrace();
              }

    The answer is in the JavaMail FAQ.

  • File downloading problem

    Hi all,
    My task is to develop a update system for an online game with Action Script 3. Now I'm coding on that download a file (a .jpg file first) to default path and display it. We don't want to allow the users to choose the downloading path by themselves. The project is developing as an air project. My idea for the default path downloading is that use URLLoader to load the .jpg file on the server side, when loading is completed, use File and FielStream class to write the .jpg file content to a local file. The following are my questions:
    1. Is this way available or not?
    2. I have written a rough program. The Event.COMPLETE event of URLLoader can be actived. Does that mean the loading process was completed?
    3. I loaded the online .jpg file as BINARY data, but the FileStream class cannot output the data to a local .jpg file correct, there isn't an exception during the whole process. How can I output it correctly?
    Thank you!

    Did you try adding a filename after the "c:\"?
    String filename="someFilename.txt";
    response.setHeader("Content-Disposition", "attachment; filename=" + "c:\"+filename);

  • RFCHKE00 - File downloading problems

    Hi all,
    We are on a roll out project for USA and we'll use checks as a payment method.
    We need to use tx FCHX to print the so called Positive Pay File, but we do not manage to know where it is stored because, eventhough we enter a path (D:\Temp\Test.rtf) on the selection screen for "File name" field no file is created in this path eventhough message FIBL621 "00000001 checks were written in the file D:\Temp\Test.rtf". We have also tried no entering anything on this field but same message appears but do neither know where it is stored nor if it have been created.
    We have never used this functionality and do not know what this printout could depend on (authorizations, predetermined paths, ...) and must also say that haven't managed to know if any customizing should be done.
    Does somebody know how to solve this? We do not know where to start from.
    Thanks in advance. Regards, 
    Abdali

    Hi,
    try searching in the forums. e.g.
    How to get Positive Pay file in FCHX Transction
    http://www.sdn.sap.com/irj/scn/advancedsearch?query=rfchke00
    Check the OSS too:
    Note 20855 - RFCHKE00 - How do you use the check extract?
    https://service.sap.com/sap/support/notes/20855
    Best regards.
    Edited by: Pablo Casamayor on Dec 28, 2011 5:49 PM

  • I am having problems downloading files from the web. After a number of files are downloaded, the system become sluggish, and then hangs. I traced the problem to the download history file: downloads.sqlite.

    After downloading a number of 1.0 MB files, the system became very sluggish, and I started to get lots of (Not Responding) messages when trying to download or just use Firefox for browsing. Using Performance Monitor, I observed that the Firefox executable was growing larger and larger - up to as large as 1.2 GB on a system with 2.0 GB memory. Page faults were off the chart.
    Looking for a similar problem, I found one that discussed the downloads.sqlite file becoming corrupted. I first noticed that this file was over 600 MB in size, so I deleted it. I then downloaded additional files, and observed that the new downloads.sqlite file would increase in size by about 150% of the size of each file that was downloaded. Once it would get up to 500 MB in size, the system started slowing down again.
    I don't know the purpose of this file, but it appears that it keeps a full copy of every file downloaded, which may be the function of a download history file, but it does not seem correct that the file should grow in size without limit, and thus impact the system.
    I would also appear that the Firefox executable is trying to read the entire contents of this file each time a new file is downloaded, which does not seem right.
    Temporary fix is to periodically delete the downloads.sqlite file when it gets too large and starts impacting performance.. Apparently it is smart enough to open a new file if the old one is not found. I am not sure what the correct behavior for this file should be. Apparently is does not re-initialize when a new Firefox session is initiated.
    Please feel free to contact me if more information is desired. I'm not sure what details you might need to troubleshoot this type of problem.

    Hi Katy, and a warm welcome to the forums!
    What is the exact name of the file?
    Is it aim.bin?
    Which requires either Stuffit Expander, or the Unarchiver to deflate.
    http://www.apple.com/downloads/macosx/systemdiskutilities/theunarchiver.html

Maybe you are looking for

  • ICloud Calendar Invites

    Hello all, Currently I have my iPad 2 utilizing iCloud with my Outlook desktop (sync app).  I have pretty basic calendar usage, my wife and I invite each other to each other's respective appointments. Last night, each of us started receiving an influ

  • How to create a photo slideshow in my movie

    Hello all, Im woking on my first movie with Premier Elements 12 and I can not figure out how to include a slideshow of pictures at the end of my movie. Of course I can drag the photos on the timeline and use trancients in between but there is nothing

  • How do I turn off Adobe Flash - too many sites have Flash Advertisements which slow the browser to less than a crawl.

    Some pages have 3, 4, 5 or more adobe flash advertisements running at the same time, which slows the browser down tremendously. Then, if you happen to have multiple tabs open, the browser crawls to a virtual standstill, and many times, stops respondi

  • Movement type to use without refering a PO and move to Unrestricted stock?

    Hi, Can i make a goods receipt with out referring a purchase order, if so what movement type should I use to move the goods to unrestricted stock so that i can use it in sales order. Can any one suggest me? Thanks Vijay

  • Waveburner don't works with my audiointerface

    I've promlems with Waveburner and my external audiointerface M-Audio (Lightbgrige). Always when I change the settup to my Interface, Waveburner changet automatically to the internal audiointerface. I do not know, whats the problem. can someone help m