title: PHP Fileupload to AWS EC2
body: <p>I'm currently working on a PHP-based fileupload to an AWS EC2 instance. Basically I just want to upload zip-files to a subdirectory called /uploads/. Let me show you my code so far:</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="index.php" method="POST"&gt;
     &lt;input id="file-0a" class="file" name="zipfile" type="file" data-show-preview="false"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So any uploaded file should be in $_FILES['zipfile']</p>
  
  <p>When it comes to PHP, my code looks as followed:</p>
  
  <pre><code>&lt;?php 
  
  if(isset($_FILES[zipfile])){
      error_reporting(E_ALL);
  
      $uploaddir = '/uploads/';
      $uploadfile = $uploaddir . basename($_FILES['zipfile']['name']);
  
      echo '&lt;pre&gt;';
      if (move_uploaded_file($_FILES['zipfile']['tmp_name'], $uploadfile)) {
          echo "Success\n";
      } else {
          echo "Error!\n";
  }
  
  echo 'Debugging:';
  print_r($_FILES);
  
  print "&lt;/pre&gt;";
  }
  
  ?&gt;
  </code></pre>
  
  <p>Print_r shows all necessary information, error-level is 0 and I get a tmp_name like /tmp/phpy3lQBV. But I still get the error from the else part. So I assume move_uploaded_files is returning false.</p>
  
  <p>When it comes to run the script locally on XAMPP, everything works properly. I have set the chmod to 777 on the EC2 instance. The EC2 instance is running Apache 2.4.7 and PHP 5.5.9</p>
  
  <p>I hope someone can help me with that.</p>
  
  <p>Cheers,
  Hendrik</p>