Ho una funzione su di un campo file non obbligatorio che controlla che i file allegati abbiano come estensione jpg, gif, png. (la funzione è importata da un file esterno)
codice:
function checkFile(fil, perm) {
// controllo il tipo di file
ext = fil.substr(fil.lastIndexOf("."))+".";
if(perm.indexOf(ext.toLowerCase())<0){
//alert("Il tipo di file non è un'immagine.");
return false;
} else {
return true;
}
}
La richiamo dalla mia pagina così
codice:
if(f._imagePath.value=!"" && checkFile(f._imagePath.value, ".jpg.gif.png")==false){
Il problema è che la funzione non Funziona :maLOL:
questo il messaggio che mi dà la console di Mozilla:
Errore: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/browser.xml :: destroy :: line 569" data: no]
Errore: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "http://felix/sito/new.asp Line: 33"]
Che succede??