Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

file open window in html/jsp apge

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

  • 2
1 Solution
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.)
jaggernatAuthor Commented:
>>>>>>>>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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now