We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


file open window in html/jsp apge

jaggernat asked
Medium Priority
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

Watch Question

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 http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept], but it's useless at the moment.)


>>>>>>>>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
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.