file open window in html/jsp apge

Posted on 2006-04-13
Last Modified: 2010-04-09
hi experts,
I have a requirment where i have a button in jsp page or html page. when user clicks on the button, a "file open" window must be opened and user must be able to select a file type(BMP orPNG or JPG from the file type drop down.
Any ideas how i can approach on this . any code is greatly appreciated

Question by:jaggernat
    LVL 8

    Expert Comment

    As far as I know, you can let the user open a file dialog from an <input type="file" /> (it's HTML), but you cannot specify what file types they can choose only from.

    (In fact there is an "accept" attribute for <input type="file" /> which intended to give a similar effect ["User agents may use this information to filter out non-conforming files when prompting a user to select files to be sent to the server", from HTML 4 spec], but it's useless at the moment.)
    LVL 10

    Author Comment

    >>>>>>>>but it's useless at the moment

    why? cant i use something like

    <input name="button" type="file" ACCEPT="image/*,video/*" value="Browse"/>

    thanks for the response
    LVL 8

    Accepted Solution

    Of course you can, but the browser does not support it, i.e., the browser will not limit the user's choice to only Images & Videos.

    You can try creating a sample webpage containing this. When you click on the "Browse" you can only see a file dialog with "All Files" shown.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Crazy font shrinkage with Firefox 11 55
    Html and mvc 3 28
    Lines Not Lining Up 2 35
    HTML Check box only for display 3 34
    Introduction This warning has to be one of the most commonly issued warnings in the history of PHP.  The article explains why this warning arises and what to do to mitigate the problem. How this Happens HTTP headers include many different kinds…
    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
    In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now