sree2010
sree2010

Reputation: 73

How to make HTML file upload control to select dialog only image file types like jpg,png etc

i want to select only image files only

Upvotes: 1

Views: 1916

Answers (2)

Pekka
Pekka

Reputation: 449733

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

Upvotes: 0

Sjoerd
Sjoerd

Reputation: 75659

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?

Upvotes: 2

Related Questions