How to limit the size of files users upload to my website?

Thank you Yisrael for the link, it seems to be just what I need, but I also have a syntax issue here. Could you please tell how it should look like? I tried this one, but after I pick a file and trigger validation function (before file’s uploading process) I get a <File[0] is undefined> console message, though I see no error warning in a code pannel. Should I use ‘value’ somehow or something else… Sorry, I’m new to code nuances.

$w("#uploadButton1").onCustomValidation( (value, reject) => {
        
        if(File[0].size > 1) { reject("File size exceeds 1") ;  }

        else { console.log('File size:', File[0].size) }        

    })