currently we have this code to upload file
<input id='fileBrowse' type='file' style="width:187px;height:20px" class='fileBrowse' onchange="onBrowseFile( this );" />
and the javascript function which does some checks is as follows:
function onBrowseFile( fb ) {
var myFSO = new ActiveXObject("Scripting.FileSystemObject");
var thefile = myFSO.getFile(fb.value);
if( (thefile.size / 1000000) > maxfilesize) {
alert( "The size of the files you have tried to drag and drop exceed the maximum allowed. Please drag no more than "+maxfilesize+" MB at a time." );
return;
}
if( fb.value.indexOf( ".exe" ) > -1 ||
fb.value.indexOf( ".asp" ) > -1 ||
fb.value.indexOf( ".aspx" ) > -1 ||
fb.value.indexOf( ".cab" ) > -1 ||
fb.value.indexOf( ".com" ) > -1 ||
fb.value.indexOf( ".dll" ) > -1 ||
fb.value.indexOf( ".java" ) > -1) {
alert( "The import of one or more files type are not permitted" );
return;
}
document.getElementById( "txtFilePath" ).value = fb.value;
}
Now the problem is we now using IE9 and IE9 security doesn’t allow us using ActivexControl without modifying security settings or registry. We can’t do that as we have 5000 users of this application.
Please suggest what else we can use to sort this out. We have to have these checks…
You could run the checks server side.