Using JavaScript to add an attribute to all

Solution:

Using jquery in wordpress

The following code uses jquery approach to solve your problem:

jQuery(document).ready($ => {

  $('input[type=file]').each(function(){
    $(this).attr('accept', 'image/*');
  });

})