1

i want to select only image files only

sree2010
  • 73
  • 1
  • 6

2 Answers2

2

This is done by the accept attribute, but it is not supported by all browsers.

<input type=file name=photo size=20 accept="image/*">

See also File input ‘accept’ attribute - is it useful?

Community
  • 1
  • 1
Sjoerd
  • 74,049
  • 16
  • 131
  • 175
0

This is difficult using the standard HTML upload control.

If you can require your users to have Flash, SWFUpload is a very fine alternative. It's even possible to filter the files the user sees in the "choose file" view by extension.

Here's a demo (change the file_types field to test).

Pekka
  • 442,112
  • 142
  • 972
  • 1,088