image upload to domain
<p>could you all please help me. I can't figure where the problem was. i create a page for people to upload there images onto my site. but the code function good at desktop with php 5.4 version and my site was upgraded to 5.3, I cannot upload image to my site. </p>

<pre><code>if(isset($_POST['submitImage'])){
        $file = $_FILES['upload'];
//      $file = basename($tms.$_FILES['upload']);
        $errors = array();
        //$file = strtolower($file);


        if(empty($file)){
            $errors[] = ' The file could not be empty ';
        }else{  


            foreach( $file['name'] as $key =&gt; $value ){
                $extensions = array("jpeg","jpg","png"); 
                $file_ext=explode('.',$file['name'][$key]);



                $file_ext=end($file_ext);

                $file_ext=strtolower($file_ext);


                if(in_array($file_ext, $extensions ) === false){
                    $errors[]="extension not allowed";
                }else{

                    $filetmp = $file['tmp_name'][$key];
                    $terget_path = SITE_ROOT.'j2image'.DS.$memmem-&gt;email.DS;
                    $dat = strftime("%Y-%m-%d %H:%M:%S", time());

                    $db_file = date("DMjGisY")."".rand(1000, 9999)."_"."{$file['name'][$key]}"."_".".".$file_ext;

                    if(file_exists($terget_path)){
                    move_uploaded_file( $filetmp, $terget_path.$db_file);               
mysql_query("insert into XXXXX values ('', $memmem-&gt;id,'$memmem-&gt;email','{$db_file}', '$dat')");


                                                    /////

                            $width = 300;
                            $height = 300;



                            $target  = SITE_ROOT.'j2image'.DS.$memmem-&gt;email.DS.$db_file;
                            $newcopy  = SITE_ROOT.'j2reimage'.DS.$memmem-&gt;email.DS.$db_file;
                            // Get new dimensions
                            list($width_orig, $height_orig) = getimagesize($target);

                            $ratio_orig = $width_orig/$height_orig;

                            if ($width/$height &gt; $ratio_orig) {
                               $width = $height*$ratio_orig;
                            } else {
                               $height = $width/$ratio_orig;
                            }

                            // Resample
                            $image_p = imagecreatetruecolor($width, $height);
                    //      $image = imagecreatefromjpeg($target);

                        //  $img = "";
                        //  $ext = strtolower($ext);
                            if ($file_ext == "gif"){ 
                                 $image = imagecreatefromgif($target);
                            } else if($file_ext =="png"){ 
                                 $image = imagecreatefrompng($target);
                            } else { 
                              $image = imagecreatefromjpeg($target);
                            }


                            imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
                        //  imagecopyresampled($tci, $img, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
                            // Output
                        //  imagejpeg($image_p, $newcopy, 80);
                            if(imagejpeg($image_p, $newcopy, 80)){
                            //  return true;
                                $terger_path = SITE_ROOT.'j2image'.DS.$memmem-&gt;email.DS.$db_file;
                                unlink($terger_path);                       
                            }   

                        ////



                    //end of if file_exists     
                    }else{
                        $message =  ' Upload extention could not be locate';            
                    }
                }
                $message =' Photo add to your gallery';         
            }
        }





}
</code></pre>
