Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get field type file js and loop

$("#my-form").find("input[type=file]").each(function(index, field){
   const file = field.files[0];
   if(file.size > 5242880 || file.fileSize > 5242880) {
      errorMessage = 'Files must be less than 5MB.';
   }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #field #type #file #js #loop
ADD COMMENT
Topic
Name
4+5 =