views:

395

answers:

4

Hi all,

Is it possible to allow the fileupload control to show only images?

When we click the Browse button it should show only images.

Geetha

+2  A: 

No, in web you can't from client side, evidently from server side you can do amazing things. For this kind of thing, programmers normally use Activex, flash or the like.

netadictos
+1  A: 

Assuming you mean uploading images only.

You can check the ContentType property of the file (I.e. image/gif).

Take a look here for an example: http://www.15seconds.com/issue/061116.htm

David Neale
not asking for validation.
anishmarokey
+1  A: 

If you mean upload, you can check this through the uploaded file Content Type, you can get it from here

fileUploadControl.PostedFile.ContentType

and here are a list of content types you can filter by: http://www.w3schools.com/media/media_mimeref.asp http://www.webmaster-toolkit.com/mime-types.shtml

Pr0fess0rX
+1  A: 

With plain <input type="file">, I am afraid it's not possible on the client-side.

However, some 3rd party uploader such as SWFUpload provides this functionality.

m3rLinEz