ma che ci stanno a fare tre cicli for??
Comunque stampa thisext, thisext2 e thisext3 in un alert, che non mi ricordo se lastIndex() ha particolari funzioni con il "."
Io lo farei così:
Codice PHP:function ExtensionsOkay() {
var extension = new Array();
extension[0] = ".avi";
extension[1] = ".mpg";
extension[2] = ".wmv";
var fileFields = new Array();
fielFields[0] = document.getElementsByName("File1")[0];
fielFields[1] = document.getElementsByName("File2")[0];
fielFields[2] = document.getElementsByName("File3")[0];
var ret = true;
for(i = 0; i < 3; i++)
{
var ext = fielFields[i].value.substring(fielFields[i].value.lastIndexOf('.'));
if(extension[i] != ext)
ret = false;
}
if(ext)
{
ProgressBar(file_upload); return true }
}
alert("ATTENZIONE!! Assicurati dell'esatto inserimento dei file!");
return false;
}

Rispondi quotando