title: Can't understand these errors coming from image upload form
body: <p>I am having this errors:<p>
  imagecopyresampled() expects parameter 2 to be resource, string given in C:\xampp\htdocs file_put_contents(): supplied resource is not a valid stream resource in C:\xampp\htdocs</p>
  
  <pre><code>&lt;?php
  if ((($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/pjpeg"))
  &amp;&amp; ($_FILES["file"]["size"] &lt; 80000))
    {
  if($_FILES["file"]["error"]&gt;0)
      {
          echo "Error:".$_FILES["file"]["error"]."&lt;/br&gt;";
      }
  else
      {
          echo "Upload: ".$_FILES["file"]["name"]."&lt;/br&gt;";
           echo "Type: " . $_FILES["file"]["type"] . "&lt;br /&gt;";
            echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb&lt;br /&gt;";
            echo "Stored in: " . $_FILES["file"]["tmp_name"];
            $tmp=$_FILES["file"]["tmp_name"];
  
       if (file_exists("images/" . $_FILES["file"]["name"]))
        {
        echo $_FILES["file"]["name"] . " already exists. ";
        }
      else
        {
          $image = file_get_contents($tmp);
          $new_image = imagecreatetruecolor(200, 200);
          imagecopyresampled($new_image, $image, 0, 0, 0, 0, 200, 200, imagesx($image), imagesy($image));
          file_put_contents($image, $new_image);
          move_uploaded_file($_FILES["file"]["tmp_name"],
          "images/" . $_FILES["file"]["name"]);
          echo "Stored in: " . "images/" . $_FILES["file"]["name"];
        }
    }
    }
    else
    {
        echo"Invalid file";
    }
  ?&gt;
  </code></pre>