Filter files by extension on browse windows

Hi,
in a servlet I have a form where I can upload files from the hard disk. There is the classic "Browse" button. When I click on it I can choose the file on a browsing windows.
I want to limit the choose of the file only to pdf files.
How can I make it to show only pdf files?
Thanks, bye
Carlo

I don't think you can do this. I could be wrong, but I've never seen it done. Your Java is running on the server and what you're talking about is controlling something on the client. Anyway, if it is possible to do what you're trying to do, it wouldn't be something you do in Java.

Similar Messages

  • Download File without displaying in browser window

    I'm trying to download a PDF file from a flash site without
    displaying the file in browser window. PDF file downloads correctly
    on a Mac with Safari without displaying in the browser, however it
    displays the PDF file in the browser window on a PC with IE 7.
    Have added a .htaccess file to server "AddType
    application/video/x-m4v .m4v .sit .zip .pdf" Can anyone tell me how
    to do this and a sample piece of code would be greatly appreciated.
    Thanks

    Ironically, when someone replies to my e-mails, which has my logo at the end (where I'm glad it shows), it also shows as an attachment in the header.
    'T'would be nice to have this feature on outgoing mail, as well as having the option to include an in-line graphic with the signature.
    I have written to http://www.apple.com/macosx/feedback/ with that suggestion.
    Thanks!
    Rick
    TiBook 867 MHz   Mac OS X (10.4.10)  

  • Open PDF file in a new browser window

    I have a PDF file on the harddrive and I call a function from BalusC :
    public static void downloadPDF(FacesContext facesContext, String path, String fileName)
    util.Logger.append("Path = " + path );
    util.Logger.append("file name = " + fileName);
    ExternalContext externalContext = facesContext.getExternalContext();
    HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
    File file = new File(path, fileName);
    BufferedInputStream input = null;
    BufferedOutputStream output = null;
    try
    //open file
    util.Logger.append("1");
    input = new BufferedInputStream(new FileInputStream(file), 10240);
    //Init servlet response
    util.Logger.append("2");
    response.reset();
    util.Logger.append("3");
    response.setContentType("application/pdf");
    util.Logger.append("4");
    response.setContentLength((int)file.length());
    util.Logger.append("5");
    response.setHeader("Content-disposition", "inline; filename=\"" + fileName + "\"");
    util.Logger.append("6");
    output = new BufferedOutputStream(response.getOutputStream(), 10240);
    util.Logger.append("7");
    //write file contents to response
    byte[] buffer = new byte[10240];
    int length;
    util.Logger.append("8");
    while ((length = input.read(buffer)) > 0)
    output.write(buffer, 0, length);
    util.Logger.append("9");
    //finalize task
    output.flush();
    util.Logger.append("10");
    catch (IOException e)
    util.Logger.append("reporting.Utilities :: downloadPDF :: " + e.getMessage());
    finally
    util.Logger.append("finally");
    close(output);
    close(input);
    //inform JSF that it doesn't need to handle response
    //this is very important, otherwise you will get the following exception in logs:
    //java.lang.IllegalStateException: cannot forward after response has been comitted
    facesContext.responseComplete();
    private static void close(Closeable resource)
    if (resource != null)
    try
    resource.close();
    catch (IOException e)
    e.printStackTrace();
    This works like a charm, but the problem is that the PDF is opened in current window instead of a new one. I checked posts on this problem on this forum but i haven't found any answer to my problem. As you can see i added some 'idiot' logs just to make sure i have no errors. I see them all in my log file and there is absolutely no error. I simply see the PDF in the same window.
    Can anyone help me, please?
    Thank you.
    (Pls tell me if you need any other information)

    My problem is that the parent form has 4 buttons and a grid.
    3 buttons are Add/Edit/Delete for records in the grid. Only the 4th button is the Print report and this is the only one i need to open in another page.
    Even if I create another page and I navigate to it, setting target of newly created page to open a new window will bring me the problem of having 2 windows to close once users wants to close the PDF which is kind of awkward.
    What is your advice?
    Thank you
    Marius

  • PDF file opens in a browser window.

    I am creating a page in Dreamweaver that has a bunch of links that contain animations. The animations were created first in Powerpoint then saved as a PDF file so the user would still be able to perform the animations yet keep them from being copied.
    When you click on the link to the PDF file the file opens in a web browser with the browser menu bar and I cannot see the PDF menu bar at the top like "FILE, EDIT, VIEW, DOCUMENT, COMMENTS, etc.
    How do I get the file to open and still be able to use the menu bar at the top?
    Thanks for your help.
    Pat

    You can't control that, it is determined by the visitors browser configuration and whether or not they have a PDF browser plugin. In your case, it sounds like you don't have the Adobe PDF plugin for the browser you are using. You might want to try reinstalling Adobe again. This shouldn't be a problem for most visitors. What browser are you using?

  • How do I set Firefox to automatically view text files in my browser window? Sometimes FF insists on downloading them instead.

    I use my browser to monitor real time data streams (oceanography) and want to be able to view processing log files directly in my browser window. I have symbolic links from these logs (*.log) to my web server's document directory, using .txt as a file extension for the link (e.g. procdir/argos.m.log -> webdocs/argos_m_log.txt).
    Some of these files will display in the browser window, but sometimes FF insists on downloading them instead. The only difference I can see betweens ones that work and those that don't (looking at the original log files) is that the "file" command shows some to be 'ASCII English text' and some (the ones that won't display) to be 'data'. I assume this means there's one or more unprintable characters in the source file - but I'd still like to view these directly in my browser window.

    Prefix the link with the view-source: protocol (don't put a space between the protocol and the http link).
    *view-source:https://support.mozilla.org/en-US/questions/910776

  • Open file in new browser window

    Hello,
    The contents of file is stored as a blob object in database. The filename(.pdf, .csv, .txt) is displayed as a commandlink in a page. On click of the commandlink I would like to display the contents of the file in a new browser window. How do i do it.
    Thanks in advance for your help.
    Kalpana

    Thanks for the reply. I tried opening a pdf file from the local drive and it works fine.
    My requirement is the outputlink displays a list of files in a datatable. On click of the link I need to read the file from the database. The file resides in the database as a blob.
    Now issue is on click of the outputlink i am not able to get the name of the file. Is there any way to get the name of the file.
    Thanks in advance for the help.
    Kalpana

  • Opening pdf file in a  browser window.

    I have a requirement to open a pdf file in a new browser window after onClick of a link. It is not the url of the pdf file. Actually the pdf file is generated dynamically by reading a blob column from the database and converting into a byte array and writing it to the outputstream. This is the code
    Currently on click of the link we are opening a jsp file which has the following code. We have put target=_blank in the link.
    String fileName = "DownLoadFile.pdf";
    response.setContentType("application/pdf");
    response.setHeader("Content-Disposition", "inline;filename=\""+ fileName + "\"");
    response.setContentLength(retrieveDocumentValue.getDocumentObj().length);
    try{
    ServletOutputStream out1 = response.getOutputStream();
    out1.write(retrieveDocumentValue.getDocumentObj());
    out.close();
    } catch (IOException e) {
    out.println("IO Exception");
    e.printStackTrace();
    }The problem is that,It is opening two window, one is an blank browser window and other pdf file in the Acrobat reader application? How can we open the file directly in the browser only without opening the Acrobat reader application externally?
    Edited by: thisisananth on Sep 17, 2008 11:13 PM

    We are facing this problem with IE6 browser only. In firefox, it opens fine in a browser window. What configuration should we do in IE6?
    Thanks,
    Ananth.

  • Problem opening html file in separate browser window

    I have an forms app where a user can download a file from the database and then open that file on the client. After the file is downloaded, I use webutil_host.nonblocking ('cmd /s start' ||filename) and it works fine for .doc, .xls etc. as these open a separate program. Problem occurs when user downloads an html file, the command opens the file in the same browser window as forms is running, thus ending the forms session.
    I've tried web.show_document('file:\\'||filename) but that fails as I assume it is looking for the file on the application server instead of on the client.
    Any ideas on how to workaround this issue?

    Well I searched around on google looking for a java servlet or jsp example and couldn't find one. I know they are out there becasue thats where I got mine about a year ago. I dont work at the same place anymore and couldnt take my code with me. Anyway, you would use this servlet for any document (xls, doc, html, txt, pdf) that is in the blob column in the db. The servlet would send a mime type first in the response and then the blob. The browser would display the blob in the associated helper application on the client (Excel, Word, IE, notpad, Adobe Acrobat Reader, etc..). The user can then save the document to their hard drive if they wish. This is faster becasue the clients hard drive isnt involved in the transfer from db to client. The user can then edit the document and reupload the document. Thats how we did it.
    Maybe somebody else can post a link to a generic blob download servlet? Thanks..

  • Adobe Reader in browser window disappearing-need help

    I have created a word document (WD1) containing links to other word documents (WD2, WD3, etc). I then turned WD1 into a .pdf file. I then upload this .pdf file to a web page. I go to this webpage and click the link to open the WD1.pdf file. When I click the WD1.pdf link on the webpage, a new browser window opens with Adobe reader in it displaying WD1.pdf. so far so good. Now when I click on the links to WD2 or WD3, these links open in Word and the correct files display, but the browser window containing WD1.pdf file disappears (thats the best way to describe it) and the first webpage is still open.
    What I am trying to achieve is to have the second browser window stay open so the trainees using this web page will be able to click on the other references on the .pdf to get to all of the links without having to re-open it each time.
    I have Researched in help and web forums, the only reference I can find is to uncheck the box next to Open cross-documents in the same window in preferences in Adobe. Which I have done and restarted my computer. I also noticed a preference show each document in its own window which is checked.
    Here is the other rub, I have a desktop computer (OS is XP) and a laptop (OS is vista). I have Adobe 8.1.2 installed on both. The laptop with vista works the way I would like. But the desktop computer with XP does not. I did have Adobe 7.0.9 on the desktop but when it did do what I wanted I upgraded to 8.1.2 and it still isnt working. The real problem is that most of the trainees will be using their work computers with XP. I dont know even know if there is any significance in this observation or not. But thought I would throw it out there.
    Does anyone have any suggestions of things I could try or know of any solutions? Please help.

    There is a technology on Labs called BrowserLab that is designed to assist with browser compatibility. Is this question regarding BrowserLab or is the question more general?

  • When I open a pdf file, Firefox opens a blank window, then the file opens in a Adobe Reader window. How can I stop the blank window?

    Whether I am using Firefox 3.6.8 or Thunderbird 3.0.6, clicking on a pdf file opens a new window. After a few seconds the pdf file opens in a separate Adobe Reader window. When I am done with that and close it, I still have to go back and close out the blank window. Got to be a configuration issue some place. I have tried several settings under Tools/Options, but haven't found the right setting yet. Any suggestions?

    Thank you very much for the reply. I followed your instructions. This fixed half of the problem. Links to pdf files that are on web pages now come up with a box that asks if I want to open or save the file, without a blank browser window in the background. That is great.
    When I tested the fix with pdf file links in email, the problem still exists. I tested links in Outlook Express, Yahoo mail, and Gmail. Any time I click on a pdf link in an email, a blank Firefox window opens and then I get the small window that asks me if I want to open or save the file. Sounds like this is a configuration issue, not a technical problem. Thanks for your help.

  • .SWF File cannot be launched on Windows XP

    When trying to launch a SWF file, "MyFirst.swf", Windows XP
    informs me of the following:
    <<
    Windows cannot open this file
    What do you want to do?
    1.- Use the web to find the programm
    2.- Select the programm from a list
    >>
    [NB: I've translated Windows XP's output from Spanish, so in
    English it'd probably look different]
    I've tryed the 2 options and I've checked that I've got the
    latest Flash Player version available, i.e., v 9,0,45,0 from:
    http://www.adobe.com/es/software/flash/about/
    but how can I tell windows where the Flash Player is?, I've
    chosen the path:
    C:\WINDOWS\system32\Macromed\Flash
    but which programm do I have to select?, "FlashUtil9c.exe",
    "NPSWF32_FlashUtil.exe"?, maybe other?
    Any help will be appreciated.

    juanfdezgcia;
    The free flash active x control and/or NS compatible plug-in
    player is
    only utilized from a browser (or other application)--it is
    not meant to be a
    "standalone player" for swf files. You can drag your swf
    files to an open
    browser window...
    -Tom Unger

  • Opening hyperlinks in the same browser window

    Hey Gang!
    How does one create a hyperlink such that it opens in the
    same browser window and doesn't keep opening a new window each
    time?
    Cheers!
    Gregory

    Do you meant that you want to "open the hyperlinks of your flash file in the same browser window"
    You flash file will be put on the internet and I think you have to configure your brower to achieve this goal.
    We all know that IE can be configured to open the hyperlinks in the same window.
    Thus if you want your flash file achieve this feature you need to write a code to control your brower.
    This code can be a simple JS code. You can just google this to find out the answer.
    good luck
    I love using flash quiz generator

  • Filter file type for af:inputFile

    Hi,
    I am using jDeveloper 11.1.2.4.0.
    I used af:inputFile to get an image file and save the file to the server.
    Is it possible to filter file types when I browse file from af:inputFile? My users would like to see only image files when they browse in the directory.
    Thanks.
    nat

    <input type="file"> has property "accept", so you can add this attribute after page load, for example:
    <af:clientListener method="onPageLoad" type="load"/>
    <f:facet name="metaContainer">
        <af:resource type="javascript">
            function onPageLoad(evt) {
      // yourInputFileId is id of <input type="file"> element so you need to use firebug or similar tool to find this id
                document.getElementById("yourInputFileId").setAttribute("accept", "image/*");
        </af:resource>
    </f:facet>
    but note that this property is not supported in all browsers (especially in IE )
    Dario

  • Add option to open swf in new browser window

    Hello,
    I have a small animation on a webpage. The properties are to
    small to view all details. Can I add functionality to this swf that
    the user can open the swf file into a new browser window. This
    allows then for scaling to what ever size is appropriate.
    Any suggestions??
    Thanks!

    Hi,
    I hope I understood your question correctly, if so my suggestion may be helpful. Otherwise I think it's nearly the same what paul writes, I only made clear my proposal in a website for you, first a photo:
    and here is the link: http://www.goldschmiede-blumberg.de/pdf/adob_pdf.php.
    Note 1: "Ausgabe 9" und "ein Mausklick hier genügt" are links!!
    Note 2: " Um pdf-Dateien ...." Means: To read pdf files, you need the free Adobe Reader. The current version you can download from the Adobe website.
    Look at it's source code.
    Viel Erfolg
    Hans-G.

  • Browser Window Size via an LMS

    Greetings,
    We post our movies to an LMS and everything works just great.
    One thing: I'd like the movies launch via theLMS to appear in
    a specific window size. I can edit the .html files and manually
    paste a javascript into the file to make this happen. But that
    means I have to edit the html file each time. That can be a bit
    problematic considering we have several hundred movies.
    I believe that editing the seed "standard.htm" file with a
    javascript will make this happen. Is there another seed file that I
    need to edit as well? For instance, is there something I need to do
    to the scorm_support.htm file located in the Scorm Support folder?
    Either way, does someone have a javascript I can paste into
    either file? I cannot seem to be able to make this work.

    CBTer,
    I'm not sure if you found it, but since you are using
    Captivate, you can
    modify the "template" file (depending what version of
    Captivate, it's found
    at "C:\Program Files\Macromedia\Captivate\Templates\Publish")
    and find the
    AICC.htm or SCORM.htm files for editing. NOTE: This would
    only affect the
    size of the Flash application in the browser.
    If you want to affect the actual browser window, you can
    [potentially] make
    a change in your LMS, if it's supported as previously
    suggested OR you can
    make a new HTML file that redirects to your
    Captivate-published file. This
    is more tricky if you need to support the AICC standard. I
    think I have
    something around - are you using AICC or SCORM?
    Oh, to affect the actual browser window - you really want to
    do this when
    the browser is LAUNCHED and thus should modify the thing that
    actually
    launched the browser (whether this is the LMS or a new
    browser file that
    launches another browser window using the settings you want).
    Regards,
    Andrew

Maybe you are looking for

  • Black screen after KDE update (14.12.1)

    A few errors or warning in .xsession.errors (don't know if they're relevant): plasma-desktop(865)/libplasma Plasma::isPluginVersionCompatible: unversioned plugin detected, may result in instability plasma-desktop(864): Communication problem with "pla

  • Transforming non-theme data in Mapviewer

    Hi, We have generated a request to display a linestring over the top of a map base. At each end of the linestring are a marker to denote the start and end of the string. The challenge arises when we transform the map base to a desired projection (SRI

  • Photoshop CS6 - Visual impressions

    So, I watched the promotional videos, got hyped up and downloaded CS6 beta. I love some of the new features, like all the different tile options and as someone who works with many many layers, I LOVE that you can now filter them and even search by na

  • Place a widget in the Dock?

    Hi again! Another question popped into my head after installing and testing a very useful widget called DeepSleep; it lets you do what you might expect, i.e. put your Mac in hibernation, but I'd like to access it directly from the Dock, without havin

  • I need my money back!! PLEASE HELP ME!

    I'm trying to cancel an in-app purchase and I keep getting the run around with phone numbers and this site can be confusing.  Can anyone help me please!!!!