title: Php - upload file with ajax
body: <p>my 2form.php :</p>
  
  <pre><code>&lt;script type="text/javascript" src="mootools.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      function test()
      {
          url = '2form.php';
          var ajax = new Ajax(url, {
              method: 'post',
              onComplete: function(response) {            
                  document.getElementById('error_upload_logo').innerHTML = response;
              }
          });     
          ajax.request();
      }   
  &lt;/script&gt;
  &lt;?php
      if($_FILES)
      {
          echo "&lt;div&gt;";
          foreach($_FILES['name'] as $v)
          {
              echo $v."&lt;br/&gt;";
          }
          echo "&lt;/div&gt;";
      }
      else
      { ?&gt;
          &lt;form action='' id='form1' name="form1" method="post" enctype="multipart/form-data"&gt;
              &lt;input type="file" name="name"/&gt;
              &lt;input type="submit" name="submit" onclick='test(); return false;'/&gt;
          &lt;/form&gt;
  &lt;?php
      }
  ?&gt;
  
  &lt;div id="error_upload_logo"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>if run code with out javascript , it 2form.php like simple php page, and </p>
  
  <p>we can see information of $_FILES that was printed to scrreen</p>
  
  <p>But if i have run with javascript by test() function , </p>
  
  <p>i don't get information in $_FILES ? </p>
  
  <p>How to get $_FILES ? when click button run with javascript ?</p>
  
  <p>i want to upload with ajax </p>