Skip to content

Instantly share code, notes, and snippets.

@raulghm
Last active August 29, 2015 14:00
Show Gist options
  • Save raulghm/11382407 to your computer and use it in GitHub Desktop.
Save raulghm/11382407 to your computer and use it in GitHub Desktop.
function hasFileUploadSupport(){
var hasSupport = true;
try{
var testFileInput = document.createElement('input');
testFileInput.type = 'file';
testFileInput.style.display = 'none';
document.getElementsByTagName('body')[0].appendChild(testFileInput);
if(testFileInput.disabled){
hasSupport = false;
}
} catch(ex){
hasSupport = false;
} finally {
if(testFileInput){
testFileInput.parentNode.removeChild(testFileInput);
}
}
return hasSupport;
}
alert(hasFileUploadSupport());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment