JSFiddle - React, Tailwind, and code Playground

by Mateusz

HTML

<center><form id="form1" runat="server">
        <input type='file' id="imgload" />
    </form></center>
    
    <div id="content">
            <img id="imgprew" class="img1" src="#" alt="" />
            <img id="imgprew" class="img2" src="#" alt="" />
    </div>

CSS

body{
    background: #424242;
    padding:25px;
}
#content{
    background:#757575;
    position: relative;
    width: 500px;
    height: 400px;
    margin:20px auto;
}
#imgprew{
    display: block;
    position:absolute;
    height:64px;
}
.img1 {
  top:25px;
  left:50px;
  }
.img2 {
  top:100px;
  left:105px;
  }

JavaScript

function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            
            reader.onload = function (e) {
                $('#imgprew').attr('src', e.target.result);
            }
            
            reader.readAsDataURL(input.files[0]);
        }
    }
    
    $("#imgload").change(function(){
        readURL(this);
    });