Trying to add validation for my files to see if the files being uploaded exceed 5MB, however it doesnt alert if the file is over 5MB, Can anyone see what is wrong with my validaiton in my IF statement? This is a multi file upload which works fine but the validation doesnt
function makeProgress(number){
var url = getRelativeURL("web/fileUpload");
var formData = new FormData();
formData.append('number', number);
fls = document.getElementById("attachmentFileUploadInput").files; //number of files...
console.log(fls);
for(j=0;j<fls.length;j++){
if (fls.size > 5000000) //5MB
{
console.log('error');
alert('file to big');
}
else
{
formData.append('files[]', fls[j]); //note files[] not files
$.ajax({
url : url,
data : formData,
fls[j].size