title: JQuery uploadify to store images in mysql
body: <p>I am trying to insert multiple images into mysql database using uploadify.
  My database is having one of it's column to be type longblob.
  Every time I select multiple files,only my first image gets inserted successfully.I have set multi = true.I am unable to get more than one image inserted and also whenever I click on the upload link,the onComplete event does not get executed.There is no error displayed.
  For some reason my script is not able to insert more than one image and as a result my upload complete event is not getting called.</p>
  
  <p>Most of examples I have come across,do not insert the actual image but just the path of file name into database.Can anyone please help me to get my script to upload multiple images into the db?</p>
  
  <p>this is my index.php script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
   $(document).ready(function() {
  
  //alert('I am ready to use uploadify!');
  $("#picture").uploadify({
      'uploader': 'uploadifyit/uploadify.swf',
      'script': 'sqlupload.php',
      'cancelImg': 'uploadifyit/cancel.png',
      'folder': 'uploads',
      'auto': false, // use for auto upload
      'multi': true,
      'queueSizeLimit': 4,
      'sizeLimit': 10000000,
      'onQueueFull': function(event, queueSizeLimit) {
          alert("Please don't put anymore files in me! You can upload " + queueSizeLimit + " files at once");
          return false;
      },
      'onAllComplete'  : function(){ 
      alert("Thank you. All files have been uploaded successfully."); 
      },
      'onComplete': function(event, ID, fileObj, response, data) {
          console.log(response); // If you're using firebug
          alert(response); // Will alert the php error
      },
      'onUploadError' : function(file, errorCode, errorMsg, errorString) {
          alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
      }
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>sqlupload.php</p>
  
  <pre><code>        &lt;?php
           mysql_connect("localhost", "root", "")or die(mysql_error());
            mysql_select_db("project") or die(mysql_error()); 
  
           if (!empty($_FILES)) {
  
           $fileTypes = array('jpg','jpeg','gif','png'); // File extensions
           $fileParts = pathinfo($_FILES['Filedata']['name']);
  
       if (in_array(strtolower($fileParts['extension']),$fileTypes)) {
  
      $pic_name = $_FILES['Filedata']['name']; 
          $pic_size = $_FILES['Filedata']['size']; 
          $pic_type = $_FILES['Filedata']['type'];
      $imgData =addslashes(file_get_contents($_FILES['Filedata']['tmp_name']));    
  
  // our sql query
        $sql = "INSERT INTO photos (name,type,size,image)   VALUES('$pic_name','$pic_type','$pic_size','$imgData')";
   // insert the image
  mysql_query($sql) or die("Error in Query: " . mysql_error());
  }
  else {
  echo "Invalid file type";
  }
  }
  </code></pre>
  
  <p>?></p>