title: PHP upload script works locally, however not on remote server
body: <p>It's strange, this script works locally (on MAMP), but not on my remote server (Bluehost). I tried adding some POST data, and that worked, however the file upload isn't working at all. Any ideas?</p>
  
  <pre><code>//upload file
  if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg")) &amp;&amp; ($_FILES["file"]["size"] &lt; 2000000) &amp;&amp; isSet($_FILES["file"])){
  if ($_FILES["file"]["error"] &gt; 0){
      echo "&lt;div class='error'&gt;Return Code: " . $_FILES["file"]["error"] . "&lt;/div&gt;";
  }else{
      if (file_exists("../upload/" . $_FILES["file"]["name"])){
          echo "&lt;div class='error'&gt;" . $_FILES["file"]["name"] . " already exists. &lt;/div&gt;";
      }else{
          move_uploaded_file($_FILES["file"]["tmp_name"],
          "../upload/" . $_FILES["file"]["name"]);
      }
  }
  }else{
  if((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg"))){
      //echo "&lt;div class='error'&gt;Invalid file&lt;/div&gt;";
  }else{
      if(isSet($_FILES["file"]["type"]) &amp;&amp; !isSet($message)){
          echo "&lt;div class='error'&gt;Invalid file type.&lt;/div&gt;";
      }
  }
  }
  </code></pre>
  
  <p>Here is the upload form.</p>
  
  <pre><code>&lt;form action="index.php" method="post" enctype="multipart/form-data"&gt;
              &lt;div&gt;
                  &lt;input type="file" name="file" id="file" /&gt;
                  &lt;input type="submit" id="submit" value="Submit" /&gt;
              &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>The upload folder's permissions are set to "775".</p>
  
  <p>I'd appreciate any help/ideas.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Problem solved. It was a php.ini issue. I'm not sure where the problem was exactly. However, when I restored the default php.ini, file it worked.</p>