TheNorthFace TheNorthFace - 3 months ago 7x
Javascript Question

HTML form with multiple file upload fields, how to check max file size client side

I have this simple script that checks max file size client side in a html form. The check works for the first file added, but I'm having a struggle finding out how to apply the method for checking the other input fields as they are dynamically added.

The check is based on

var uploadField = document.getElementById("file1");

Check out this fiddle to better understand the issue:

Any tips on how to solve this would be much appreciated.


Do a check for total number of File Input items and validate. Updated