I am trying to upload multiple files via
<input type="file" id="uploadFiles" multiple onchange="checkFileUploadExt(this);"/>
using javascript
function checkFileUploadExt(fieldObj)
{
var control = document.getElementById("uploadFiles");
var filelength = control.files.length;
var FileName = fieldObj.value;
var FileExt = FileName.substr(FileName.lastIndexOf('.') + 1);
if ((FileExt.toUpperCase() != "PDF"))
if ((FileExt !== "pdf") || (FileExt !== "PDF"))
{
var error = "File type : " + FileExt + "\n\n";
error += "Please make sure your file is in pdf format .\n\n";
alert(error);
fieldObj.value = '';
return false;
}
return true;
}
but here
multiple pdf files->success
single other files(.txt,.doc etc)->success
pdf+(txt or doc)-> fail
my need is only pdf files can accept when multiple selection. and also it shows errors in files.length on Interner Explorer how to do this