Can anyone please help me. I’m trying to create a form which checks that a file is not over 39kb.
if ($_FILES['ufile']['size'][0] > 39000){
//Also tried if ($_FILES['ufile']['size'] > 39000){
echo "Sorry this file is over 39kb";
}
<input name="ufile[]" type="file" id="ufile" tabindex="6"/>
If you are still naming your input field as ufile then $_FILES[‘ufile’][‘size’] will be an array. You can see that from the second bit of code you posted (the var_dump)
["size"]=> array(1) { [0]=> int(3365)
You need to check $_FILES[‘ufile’][size’][0], and if you need the to create multiple upload fields you’ll need to do this in a loop so you can check all of the uploads, not just the first one.
If you DON’T need multiple uploads get rid of the in your HTML.