title: file created with 0 bytes during file upload in php
body: <p>Its kinda crazy, happening on my Ubuntu OS. </p>
  
  <p>Trying to upload a file with the following script, Its creating a file with Zero bytes in the upload folder, Not sure whats going wrong. Can somebody have a look.</p>
  
  <p>Here is my attached script</p>
  
  <ol>
  <li>file1 - Name of the file input html element. </li>
  <li>uploadbtn - name of the submit button.</li>
  </ol>
  
  <p>Code:</p>
  
  <pre><code>// App Config 
  
  $app_dir = '.';
  
  $uploaddir = $app_dir . '/uploads/';
  
  $filetype  = 'text/xml';
  if ( isset($_POST['uploadbtn'] ) ){
          // Upload a file
          print_r( $_FILES );
          if ( !isset($_FILES['file1']['name']) || $_FILES['file1']['name'] == '' ) {
                  echo 'No files uploaded, Pls upload a file';
                  exit;
          }
          //print_r ( $_FILES ); 
  
          $filename = basename( $_FILES['file1']['name'] );
  
          $uploadfile = $uploaddir . $filename ;
  
          if ($_FILES['file1']['type'] != $filetype ) {
                  echo 'Sorry, your file was not of the ' . $filetype . ' mimetype (yours was ' . $_FILES['file1']['type'] . ').';
                  exit;
          } // End filetype check 
  
          $upload = move_uploaded_file($_FILES['file1']['tmp_name'], $uploadfile );
  
          if ( !$upload ){
                  echo ' Uploading UNSUCCESSFUL ';
                  print_r( $_FILES );
          } else {
                  echo ' Uploading Successfulllllllllllllll';
          }
  
  }
  </code></pre>