title: AWS Elastic Beanstalk file upload not working
body: <p>We use AWS Elastic Beanstalk to host PHP applications which include file upload facilities which aren't working. We have php.ini set the tmp_upload_dir to /tmp but it still doesn't work.</p>
  
  <p>We've just moved the site from another server, everything was working perfectly there, but EB doesn't seem to want to let us upload files.</p>
  
  <p>Here's an example of the code we are using:</p>
  
  <pre><code>$imagePath = "/tmp/";
  
  $allowedExts = array("gif", "jpeg", "jpg", "png", "GIF", "JPEG", "JPG", "PNG");
  $temp = explode(".", $_FILES["img"]["name"]);
  $extension = end($temp);
  
  if ( in_array($extension, $allowedExts))
    {
    if ($_FILES["img"]["error"] &gt; 0)
      {
           $response = array(
              "status" =&gt; 'error',
              "message" =&gt; 'ERROR Return Code: '. $_FILES["img"]["error"],
          );
          echo "Return Code: " . $_FILES["img"]["error"] . "&lt;br&gt;";
      }
    else
      {
  
        $filename = $_FILES["img"]["tmp_name"];
        list($width, $height) = getimagesize( $filename );
  
        move_uploaded_file($filename, $imagePath . $_FILES["img"]["name"]);
  
        $response = array(
          "status" =&gt; 'success',
          "url" =&gt; $imagePath.$_FILES["img"]["name"],
          "width" =&gt; $width,
          "height" =&gt; $height
        );
  
      }
    }
  else
    {
     $response = array(
          "status" =&gt; 'error',
          "message" =&gt; 'something went wrong',
      );
    }
  </code></pre>