View Single Post
Old 09-05-2012, 04:18 PM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,554
Thanks: 9
Thanked 480 Times in 463 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by Philip M View Post
The accept attribute is not supported in Internet Explorer and Safari. That makes it pretty useless.
http://wufoo.com/html5/attributes/07-accept.html

seems like both support it. it's a cheap addition that works for most users and even without javascript.

certainly simpler than jQuery.

covering all the bases:

Code:
<input type=file
  accept="image/*" 
  pattern="/\.(gif|jpe?g|png)$/i" 
  onchange='if(
   (  this.files   &&
      this.files[0] &&
     !this.files[0].type.match("image/*")     ) ||
     !this.value.match(/\.(gif|jpe?g|png)$/i)    ){ 
      this.value=''; } '
 />
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:15.2% IE7:0.5% IE8:8.4% IE9:8.5% IE10:8.5%

Last edited by rnd me; 09-05-2012 at 04:26 PM..
rnd me is offline   Reply With Quote
Users who have thanked rnd me for this post:
MrTIMarshall (09-06-2012)