S
SomeDude
Hi group,
I'm trying to check file-extensions before allowing file-uploads.
My script reads the value perfectly but can not update it.
Firefox's Javascript Console even mentions the following:
Error: uncaught exception: [Exception... "Security error" code: "1000"
nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location:
"http://www.prosess.nl/fideldidel/final/website/mmc/includes/cuptech.js
Line: 56"]
Am I doing something incredibly dumb (again ?
TIA,
SomeDude
My form:
<form name ="upload" enctype="multipart/form-data" action="<?php echo $page_url . "&mode=upload";?>" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
Add picture:
<input id="userfile" name="userfile2" size="50" type="file" onChange="checkFileExtension('userfile');" />
<input type="submit" value="Uploaden" onSubmit="checkFileExtension('filename', document.getElementById('userfile').value);"/>
<input type="hidden" name="collection" value="<?php echo $collection;?>" />
</form>
My function:
function checkFileExtension (caller){
alert ('Check extension for ' + caller) ;
objField = document.getElementById(caller);
strFileName = objField.value;
alert ('strFileName = ' + strFileName);
objField.value = 'n00b'; // VALUE IS NOT SET !!!
alert ('objField.value = ' . objField.value);
}
I'm trying to check file-extensions before allowing file-uploads.
My script reads the value perfectly but can not update it.
Firefox's Javascript Console even mentions the following:
Error: uncaught exception: [Exception... "Security error" code: "1000"
nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location:
"http://www.prosess.nl/fideldidel/final/website/mmc/includes/cuptech.js
Line: 56"]
Am I doing something incredibly dumb (again ?
TIA,
SomeDude
My form:
<form name ="upload" enctype="multipart/form-data" action="<?php echo $page_url . "&mode=upload";?>" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
Add picture:
<input id="userfile" name="userfile2" size="50" type="file" onChange="checkFileExtension('userfile');" />
<input type="submit" value="Uploaden" onSubmit="checkFileExtension('filename', document.getElementById('userfile').value);"/>
<input type="hidden" name="collection" value="<?php echo $collection;?>" />
</form>
My function:
function checkFileExtension (caller){
alert ('Check extension for ' + caller) ;
objField = document.getElementById(caller);
strFileName = objField.value;
alert ('strFileName = ' + strFileName);
objField.value = 'n00b'; // VALUE IS NOT SET !!!
alert ('objField.value = ' . objField.value);
}