How to force file download message box appear????

I download file from oracle
how to set response header to make download message box appear??????
I just see lots of :
���?������ Y�Dl?��>��hn��?g�x~����?7���}��h`a�F��?P?!P��*�X��?/?U ��A?|?/??$�T=��t ��?^!i��f��/?]?�c��7?�UZ�Gz?��SbU��p���Q�T������?��e JyN�/�X^��w��/Bo�k�O��������^��$��?�������yg���C(??[�[+?��R�����p��?te@?��o��?M:D�_s#h�����H��g/?�nE"�PQI���A!��bE������?C`A�������?V��2�^��<�NK?[��k�k$??yJ>?sg-hm�AW(���S��?l[��[���� ��?dL4��6!�N��*���N?Q2?���JoP��>|�sb�_�^�_����~�r��X
on the screen
I am a chinese, happy new year everyone!

and the file.size() is semicode, meaning there isnt a function for it. So you might end up with something like this
     response.setContentType( "application/zip" );
     String fileName = Globals.getAttachmentLocation() + readFile;
     response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
     BufferedInputStream bufferedInputStream = new BufferedInputStream( new FileInputStream( fileName ) );
     ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
     int start = 0;
     int length = 1024;
     byte[] buff = new byte[length];
     while ( bufferedInputStream.read( buff, start, length ) != -1 ) {
          byteArrayOutputStream.write( buff, start, length );
     bufferedInputStream.close();
     response.setContentLength( byteArrayOutputStream.size() );
     response.getOutputStream().write( byteArrayOutputStream.toByteArray() );
     response.getOutputStream().flush();

Similar Messages

  • How to get file download dialog box in IE 6.0 for .CSV files?

    In our Java application, when we download .csv file (by clicking a tool bar button or menu item) in IE 5.5, it brings up the download dialog box and when we click the open button it opens the file in a seperate browser window but after migrating to IE 6.0 it doesn't bring the download dialog box and we are not able to open the excle sheet in a new browser window.
    We tried downloading .csv file in IE 6.0 by changing its extension(such as .cs1 and .xls) even then it did not work.We also tried associating CSV type of extension with "Microsoft Excel Comma Separated Values File" in the Windows folder options (Windows Explorer->tools->folder options->file types(tab)), which did not work.
    Please respond if you have come across this kind of issue and solution for the same.
    Thanks in Advance

    This has nothing to do with Java. It's Microsoft
    setting for known file type. IE is responding to the
    setting which will automatically download known file
    type (MIME type).
    To show the "Save As" file dialog, you have to do the
    following (for each file type)
    1. open Window Explorer
    2. click on Tool-->"Folder Option"
    3. click on the "File Type" tab
    4. select the extension and then click on the
    "Advance" button
    5. Check the "Confirm open after download" checkbox
    6. Click OK
    IE should now display the "Save As" file dialog for
    that extension. Remeber, you have to to this for all
    extension you want to see a "file dialog" pop up.Unfortunately this is not the only cause. Even with this box checked, downloading java source files from the pages of The Java Tutorial causes them to open in the most recent IE - I (and others also) don't get the save/open dialog box. Java source files downloaded from (some) other websites result in the save/open dialog box. I believe that one of the security changes that MS made in IE's handling of files is the cause. The setting of content-disposition by the server appears to be the key, according to MSDN information.

  • File download dialog box problem!

    Hi,
    How do you force file download message box to use specified file name instead of JSP or servlet name.
    I am using:
    // code in attachment.jsp
    <%
    response.setContentType(mimeType.trim());
    response.setHeader("Content-Disposition","attachment;filename=\""+attachmentViewBean.getAttachmentName()+ "\"");
    %>
    With the above code, browser first pop up file download dialog box informing
    'You are downloading the file:[attachment.jsp] from host. Would u like to open the file or save?'
    I want the file name that I had specified in setHeader("Content-disposition","attachment;filename=resume.doc") to appear(i.e. resume.doc) in above dialog box and not the servlet name.
    Any suggestions/tips on this?
    Your help would be greatly appreciated.
    Thanks,
    Yogesh

    For saving the document I have used -
    res.setHeader("Content-disposition", "attachment; filename="+ FileName );
    and it is working very fine, it saves the document with name specified in FileName
    For opening the file in browser without any prompt-
    res.setHeader("Content-disposition", "inline" );
    For setting the content type -
    try {
         if(FileType.equalsIgnoreCase("pdf")) contentType = "application/pdf";
         if(FileType.equalsIgnoreCase("doc")) contentType = "application/msword";
         if(FileType.equalsIgnoreCase("rtf")) contentType = "application/msword";
         if(FileType.equalsIgnoreCase("gif")) contentType = "image/gif";
         if(FileType.equalsIgnoreCase("jpg")) contentType = "image/jpeg";
         if(FileType.equalsIgnoreCase("html")) contentType = "text/html";
         if(FileType.equalsIgnoreCase("htm")) contentType = "text/html";
         if(contentType == null){
         contentType="text/plain";
         res.setContentType(contentType);
    } catch (Exception e){
              out.println("Exception while setting content type");
              out.println("Exception : " + e);
              return;
    Hope this helps

  • Hi,my system is Mac OS X v 10.5 Leopard the problem is that when click on a file, immediately a box appears around the file and the title of the file is read !so how is it possible to escape from the voice?Thank you for your advice

    Hi,when click on a file, immediately a box appears around the file and the title of the file is read !so how is it possible to escape from the voice?Thank you for your advice

    Turn off Voiceover!
    System Preferences/Universal Access

  • How to turn off printing message box that appears every time I send a document to the printer?

    How to turn off printing message box that appears every time I send a document to the printer?  Appears bottom right corner of screen above task bar.  Printer is HP c309a All-in-One PhotoSmart printer.

    I have an Iphone 4s, and every time I receive a call and i dont answer it, the cell shows a black screen with many things to do and automatic messages to send, like "call back, save, remind, call now, call later, etc". If I don´t close it as soon as i receive the call, then the cell gets frozen in that screen and i have to restart it. Sory for my english, i´m from argentina! thaks for your help !!!

  • I have Apple ID but I can not download Apps even for free, message box appeared "This Apple ID has not yet been used with the iTunes".

    I have Apple ID but I can not download Apps even for free, message box appeared "This Apple ID has not yet been used with the iTunes".

    You can create an account without a credit card, check here:
    Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card

  • Urgent!!how to open the file download dialog box????

    Hi all,
    i'm using the browse button for the user to select the file
    and a submit button, which when cliked should open the file
    download dialog box asking for open or save.
    i searched for so many forums and websites and didn't get the
    solution yet.
    i'm using jsp.
    anyone have the jsp code for the same????
    will b more helpful if u send it to me.
    thanx in advance.

    Hi
    Use the Filedialog class.
    Let your button call a method wich contains the following Java code:
    FileDialog filedialog =
    new FileDialog( Frame1.this, "Open a File", FileDialog.LOAD );
    //witch calls this constructor: public FileDialog(Frame parent, String title, int mode)
    //use Filedialog.SAVE to save a file.
    filedialog.show();
    String filename = filedialog.getFile();//to display the name of the file
    String directoryname = filedialog.getDirectory();// to display the directory name

  • I cannot open my firefox broswer. The message box appeared that said a problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available. Under that there are debug and close program buttons.

    I cannot open my firefox broswer. The message box appeared that said a problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available. Under that there are debug and close program buttons.

    JackieMars71 I would recommend reviewing your installation log files to determine if there are any errors during the installation process.  You can find information on how to locate and interpret your installation log files at Troubleshoot install issues with log files | CC - http://helpx.adobe.com/creative-cloud/kb/troubleshoot-install-logs-cc.html.  You are welcome to post any specific errors you discover to this discussion.

  • TS3212 when installing iTunes on my new laptop a message box appears saying some sort of error has occured and i have to uninstall it then reinstall it again and it still won't work what should i do?

    when installing iTunes on my new laptop a message box appears saying some sort of error has occured and i have to uninstall it then reinstall it again and it still won't work what should i do?

    Let's try a standalone Apple Application Support install. It still might not install, but fingers crossed any error messages will give us a better idea of the underlying cause of the issue.
    Download and save a copy of the iTunesSetup.exe (or iTunes64setup.exe) installer file to your hard drive:
    http://www.apple.com/itunes/download/
    Download and install the free trial version of WinRAR:
    http://www.rarlab.com/
    Right-click the iTunesSetup.exe (or iTunes64Setup.exe), and select "Extract to iTunesSetup" (or "Extract to iTunes64Setup"). WinRAR will expand the contents of the file into a folder called "iTunesSetup" (or "iTunes64Setup").
    Go into the folder and doubleclick the AppleApplicationSupport.msi to do a standalone AAS install.
    Does it install properly for you? If so, does iTunes launch properly now?
    If instead you get an error message during the install, let us know what it says. (Precise text, please.)

  • My IPod will not sync with my computer.  The word IPod appears in the bar at the top right area of the screen, then a message box appears stating that my IPod could not be found.  Any suggestions?

    My IPod will not sync with my computer..The work IPod appears in the upper right area of the Itune window, then a message box appears stating that 'download could not be copied to the IPod because it could not be found'.  Any suggestions?

    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reboot the computer
    - try another cable
    - Try another USB port
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7

  • Problem With File Download Dialog Box

    Hi all,
    I have jsp page that allows a user to export oracle data to excel.
    I have these code in my page:
    <%@ page contentType="application/vnd.ms-excel" %>
    response.setContentType ("application/vnd.ms-excel");
    response.setHeader ("Content Disposition",
    "filename=\"historicalrate.xls\"");
    I run the page and it popups a file download dialog box with Open and Save buttons.
    When I click the Save button a Save As window opens with a hr.xsl file name and Microsoft Excel Workbook(*.xls) as save type. It is what I want.
    The problem I have is when I click the Open button on the file download dialog box it displays data in excel format on a browser well. Then I click File > save as on browser's tool bar the Save As window pop up with no file name and a default Text(tab delimited)(*.txt).
    I need the file name and Microsoft Excel Workbook(*.xls) as default save type.
    Any help would be greatly appreciated.
    Please help
    Thanks

    I have the same problem with hui_ling.
    When user click on "Open", Excel start and open excel file correctly but the file name on excel title bar. 'Cause the file name is in Japanese characters. Any one can help me?
    Message was edited by:
    TNTVN

  • Change File Name In The "File Download" Dialog Box For Web Reports

    Hi All ,
    I followed the below note to change the "File Download" name.
    How To Change The File Name In The "File Download" Dialog Box For Web Reports? Doc ID: Note:418366.1
    However its not working. Has anyone tried this and works fine ?
    Basically I wanted to change the name "rwservlet" when a report is run in an
    excel format.
    Rajesh Alex
    Rajesh Alex

    Hello,
    Have you checked if a HTTP header "Content-disposition" is returned ?
    You can use ieHTTPHEaders for IE
    http://www.blunck.se/iehttpheaders/iehttpheaders.html
    and
    Live HTTP Headers for FireFox
    https://addons.mozilla.org/en-US/firefox/addon/3829
    Regards

  • How do you keep your message from appearring on a locked screen

    how do you keep your message from appearring on a locked screen

    Go to SETTINGS --> NOTIFICATIONS --> MESSAGES
    Change "View in lock screen" to OFF
    That should sort it for you.

  • File download dialog box -running report

    I am calling one report from my Oracle 9i Developer Suite Application. When i call one report using 'delimited' format, the run runs okay opening in a new Internet Explorer(IE) instance. But, when i call another report, the File download dialog box -running report opens which asks whether u want to open the file or save it in your computer. I hope, my doubt is clear.Please help me in this as it is very urgent.
    Regards.

    This is a duplicate post. Please followup on your previous posting.
    What is the URL you specify?

  • File Download Dialog Box

    Hi,
    I am creating a site using struts framework. In that one I code one "Download" hyperlink. Which should download Excel file to the client site.
    For this I want the Windows File Download Dialog Box to pop up when the user presses the "Download"
    hyperlink on the page. This is the dialog box which prompts the user to either open the file or save
    the file.
    However, instead of File download dialog box, IE opens the text document within itself.
    From what I understand, if the Mime Type of the file I am trying to open is registered on the client
    workstation, then this dialog box wont pop up as Windows would automatically get the registered Mime
    Type from the registry and open the application. For this we need to add headers to http response (content-disposition). Where to add this header info. In JSP, Action classes?
    Can somebody help.
    Thanks

    I am facing a similar problem...however in my case my application is on Tomcat server and when the user clicks the link, he/she sees junk data (excel sheet data) in plain html which makes no sense (with lot of special chars, just like opening any binary file in notepad)
    while if i run the application in WSAD then the links work fine....is there any difference in both the servers in the way they treat file download?

Maybe you are looking for

  • Preload External Jpgs

    What is the easiest way to preload external jpgs? The client wants to update these frequently so they should be external, but I want them to show up instantly like the rest of the site once the preloading is done. Any advice? I had thought about load

  • I would like to upgrade from Lightroom 3 to Lightroom 5.  Will I loose all my presets?

    I would like to upgrade from Lightroom 3 to Lightroom 5.  Will I loose all my presets that I have purchased and created? 

  • Error message 1015 and 2003

    Hi guys and girls, I have recently stated to use an I-Phone and have encountered a problem when trying to restore the handset after it has placed itself into recovery mode. The handset currently displays the charger pointing toward the cd/music symbo

  • How to block facebook "Trendings"

    Facebook seems to think it knows what I want to see, so every time I sign on they flood the screen with various articles that I really have no interest in. Is there an easy way to block this function. I notice that Google has a free download called F

  • Local Cache containing all Distributed Cache entries

    Hello all, I am seeing what appears to be some sort of problem. I have 2 JVMS running, one for the application and the other serving as a coherence cache JVM (near-cache scheme). When i stop the cache JVM - the local JVM displays all 1200 entries eve