Please help me in creating a multiple file upload and then process it in ajax so that it can view into the page before the form is submitted

this is my form

<form name="create_memo" method="post" ENCTYPE="multipart/form-data">
<input id = "memofile" type="file" name="img[]" onchange="uploader();" multiple />
<input type="submit">

<div id="memoupload">

this is the javascript

function upload()
var xmlhttp;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  if (xmlhttp.readyState==4 && xmlhttp.status==200)

  var file = document.getElementById('memofile').value;"GET","uploadmemo.php?file="+file,true);

php file

i have to count the file in img[] file and upload it into database.
echo count('$file');

please help me.. i dont know how to initiate this..

Thanks in advance..

take a look at the jquery ajax. far fewer lines of code. it would then allow you to make multiple instances of a file upload option like "upload another file".