title: File Upload using ajax and passing a variable
body: <p>I am uploading pictures using ajax.. It's happening very well..But the problem is I can't pass the current album_id through ajax to the php page where uploading script is there..Can anyone help? Here's my code:</p>
  
  <p>index.php</p>
  
  <pre><code>$(function () {
  
       $('body').on('click', '.upload', function(){   
              var form = new FormData($('#myform')[0]);
  
                  $.ajax({
                  url: 'image_send.php',
                  type: 'POST',
                  success: function (r) {
                      $('.container').html(r);
                  },
                  data: form,
                  cache: false,
                  contentType: false,
                  processData: false
              });
          });
      });
  
  &lt;div id="image_upload_form"&gt;
  &lt;form enctype="multipart/form-data" id="myform"&gt;    
  &lt;input type="file" accept="image/*" multiple name="image[]" id="image" /&gt;
  &lt;input type="button" value="Upload images" class="upload" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I get the current album id with $album_id = @$_GET['image_album'];</p>
  
  <p>My php code: image_send.php</p>
  
  <pre><code>foreach($_FILES['image']['tmp_name'] as $key =&gt; $tmp_name ){
      if(((@$_FILES['image']['type'][$key] == 'image/jpeg') ||
      (@$_FILES['image']['type'][$key] == 'image/jpg') || 
      (@$_FILES['image']['type'][$key] == 'image/png') ||
      (@$_FILES['image']['type'][$key] == 'image/tif') ||
      (@$_FILES['image']['type'][$key] == 'image/tiff') ||    
      (@$_FILES['image']['type'][$key] == 'image/gif') ||
      (@$_FILES['image']['type'] == 'image/png')) 
      &amp;&amp; (@$_FILES['image']['size'][$key] &lt; 1073741824))      //10 mb in bytes
      {
          if(file_exists("image/".@$_FILES['image']['name'][$key])){
          echo @$_FILES['image']['name'][$keys]."Already exists";
          }
          else{
      $picture = @$_FILES['image']['name'][$key];
      $image_upload_query = mysql_query("INSERT INTO image_upload_public VALUES('','$picture','Here I want to insert the current album_id')");
              if($image_upload_query){
              move_uploaded_file(@$_FILES['image']['tmp_name'][$key], "image/".$picture);
              }
  
          }
  </code></pre>
  
  <p>I don't understand where in ajax will I insert $album_id and how will I get that in my php page..I know that my script is vulnerbale to sql injection..I can deal with that later..But for the time being I want to know how can I pass the $album_id to the other page and insert it into my database</p>