claudysta Posted November 10, 2011 Report Share Posted November 10, 2011 wenas... alguien tiene algun script que sirva para validar extensiones de archivo con javascript, pero que sea compatible con chrome??? he probado varias cosas que encontre en la web, pero solo me funcionan para firefox y explorer (safari no he probado) gracias de antemano Link to comment Share on other sites More sharing options...
cañangasñangas Posted November 11, 2011 Report Share Posted November 11, 2011 (edited) easy function validarExt(file, ext){ ret = false; datos = file.toLowerCase().split("."); ext1 = datos[(datos.length-1)]; if(ext1==ext.toLowerCase()){ ret = true; } return ret; } ejemplo <input type="button" onclick="if(validarExt('mi.archivo.mp3', 'mp3')){ alert('validado'); }" value="Validar"/> Edited November 11, 2011 by cañangasñangas Link to comment Share on other sites More sharing options...
claudysta Posted November 11, 2011 Author Report Share Posted November 11, 2011 gracias, lo voy a probar :D Link to comment Share on other sites More sharing options...
cañangasñangas Posted November 11, 2011 Report Share Posted November 11, 2011 (edited) gracias, lo voy a probar :D oka dime si te sirvio porqque lo hice a la rapida... no lo probe... eso si asegurate que ambos argumentos file, y ext sean strings... Edited November 11, 2011 by cañangasñangas Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now