JSFiddle - React, Tailwind, and code Playground

HTML

<form name="test" method="POST" atcion="send.php">
<input type="file" id="files" name="test[]" multiple />

<div id="click"></div>
</form>

CSS

div{
    width:100px;
    height:100px;
    border: 1px solid black;
}

JavaScript

function files_check(wert) {

      var files = jQuery(wert).file; // FileList object
    // files is a FileList of File objects.
    var output = [];
    for (var i = 0, f; f = files[i]; i++) {
     var name = f.name;
        var type = f.type;
        var size = f.size;
        var MBsize = size / 1000000;
        var MBs = Math.round(MBsize * 100) /100;
   
        if (size > 1000000){
        alert("Die Datei " + name + " hat " + MBs + "MB. Max Größe 1MB. Inhalte bitte neu wählen.");
        jQuery(event.currentTarget).val("");
        }
        
        if(type !== "image/jpeg" && type !== ""){
            alert("Die Datei " + name + " hat den Type: " + type + " . Nur JPG/JPEG sind erlaubt. Inhalte bitte neu wählen.");
        jQuery(event.currentTarget).val("");   
        }
    }

  }


jQuery("#click").click(function(){
files_check("#files");
});