Saturday, November 25, 2023


  1. Saas bahu or flamingo (seeason 1)
  2. Asur (Season 1, 2)
  3. The night manager (Season 1)
  4. Special Ops (K K menon - all seasons)
  5. Scam 1992
  6. Aarya (Sushmita Sen - all seasons)
  7. Criminal Justice - Behind Closed doors (Season 1)
  8. Aakhari Sach (Tamanna Bhatiya)
  9. The Family Man (Manoj Bajpai - both season)
  10. Leaked (Amazon mini tv - free)


In wish list
  1. money heist
  2. The Revenant (oscar winning 
  3. vash gujarati movie
  4. tamasha movie (ranbir kapoor)

Wednesday, March 29, 2017

Javascript - Preview of multiple images before uploading

Below is simple code snippet.

<html>
<body>
<input id="inp" type='file' onchange="readFile" multiple />
<p id="b64_0"></p>
<img id="img_0" height="150px">

<p id="b64_1"></p>
<img id="img_1" height="150px">

<p id="b64_2"></p>
<img id="img_2" height="150px">
<script type="text/javascript">

function readFile(event) {
  let files;
  files = event.target || {};
  files = files.files || [];
  if (files.length <= 3) {
    for(let i = 0; i < files.length; i++) {
      var FR = new FileReader();
      FR.addEventListener("load", function(e) {
        document.getElementById("img_"+i).src       = e.target.result;
        // below statement is nothing but base64 encoding of file.
        // it is useful when we have to upload file by sending base64 encoded string
        document.getElementById("b64_"+i).innerHTML = e.target.result;
      });  
      FR.readAsDataURL(this.files[i]);
    }
  } else {
    alert('maximum 3 files can be uploaded');
  }
}
document.getElementById("inp").addEventListener("change", readFile);
</script>
</body>
</html>

More details about this I will publish later