Trying to change pdf size of upload Javascript


I’m trying to change the upload size but i keep coming with errors.
Could anyone help propose a better way of laying out this code? Thanks,

 function validatePDF(objFileControl) {
    var file = objFileControl.value;
    var len = file.length;
    var ext = file.slice(len - 4, len);
    if (ext.toUpperCase() == ".PDF") {
        formOK = true;
        // alert(file);
    } else {
        formOK = false;
        alert("Only PDF files allowed.");

Source: Laravel

Leave a Reply