title: PHP image uploading is not working
body: <p>I have the below code which is not uploading the image tried many thing but does not work. I can not figure it out what is the issue but log ago the same code was used to work.</p>
  
  <p><strong>HTML Form</strong></p>
  
  <pre><code>&lt;form method="post" action="" enctype="multipart/form-data" name="form1"&gt;
  &lt;input size="25" name="file" type="file" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10pt" class="box"/&gt;
  &lt;input type="submit" value="Upload" name="submit"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>The last try code is below:</strong></p>
  
  <pre><code>$change="";
  $abc="";
  
  
  define ("MAX_SIZE","12000");
  function getExtension($str) {
          $i = strrpos($str,".");
          if (!$i) { return ""; }
          $l = strlen($str) - $i;
          $ext = substr($str,$i+1,$l);
          return $ext;
  }
  
  $errors=0;
  
  if($_SERVER["REQUEST_METHOD"] == "POST"){
      $image =$_FILES["file"]["name"];
      $uploadedfile = $_FILES['file']['tmp_name'];
  
  
  if ($image) {
  
          $filename = stripslashes($_FILES['file']['name']);
  
          $extension = getExtension($filename);
          $extension = strtolower($extension);
  
  
  if (($extension != "jpg") &amp;&amp; ($extension != "jpeg") &amp;&amp; ($extension != "png") &amp;&amp; ($extension != "gif")) {
              $change='&lt;div class="msgdiv"&gt;Unknown Image extension &lt;/div&gt; ';
              $errors=1;
  }else{
  $size=filesize($_FILES['file']['tmp_name']);
  
  if ($size &gt; MAX_SIZE*1024){
      $change='&lt;div class="msgdiv"&gt;You have exceeded the size limit!&lt;/div&gt; ';
      $errors=1;
  }
  
  
  if($extension=="jpg" || $extension=="jpeg" ){
  $uploadedfile = $_FILES['file']['tmp_name'];
  $src = imagecreatefromjpeg($uploadedfile);
  
  }else if($extension=="png"){
  $uploadedfile = $_FILES['file']['tmp_name'];
  $src = imagecreatefrompng($uploadedfile);
  
  }else {
  $src = imagecreatefromgif($uploadedfile);
  }
  
  echo $scr;
  
  list($width,$height)=getimagesize($uploadedfile);
  
  $newwidth=1990;
  $newheight=1100;
  $tmp=imagecreatetruecolor($newwidth,$newheight);
  imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
  
  $imu    =   mysql_query("select max(id)+1 as id from menu_items");
  $ints   =   mysql_fetch_array($imu);
  $chk    =   $ints['id'];
  
  $ids    =   $ints['id'];
  
  $srids  =   $ints['showroom_id'];
  
  $name = $_FILES["file"]["name"];
  $ext = end((explode(".", $name))); # extra () to prevent notice
  
  $ses_msr    =   $_SESSION['ses_member_id'];
  $folderPath = "images/rest_menu_items";
  mkdir($folderPath);
  
  $filename = "images/rest_menu_items/".$ids.'.'.$ext;
  $filename1 = "images/small". $_FILES['file']['name'];
  
  imagejpeg($tmp,$filename,100);
  mysql_query("
  UPDATE menu_items
  SET
      filename='".$ids.'.'.$ext."'
  WHERE
      id='".$_GET['id']."'
  ");
  
  imagedestroy($src);
  imagedestroy($tmp);
  }}
  
  }
  </code></pre>