php - Page can't be redirect when i upload image which that form in IE8 -


this function add , edit data, in form when upload image called validateprodimage() function upload image, code not working in ie8, code working fine in firefox , crome.

//for add , edit product function addeditproduct(){     $this->setgetvars();     $this->setpostvars();      if(!$this->submit || $this->submit != 1) return;      // validate image type , image size     if($this->prod_image['name'])         $this->validateprodimage();      if($this->action == "add") {          // check if product exist         $q = "and  prod_name = '".$this->prod_name."'";          if($this->getcntproduct($q) > 0)                $this->setmessage("product exist!", "error");          else {               // adding new product             $query = "insert tbl_product set                     prod_id     = '',                     prod_name   = '".addslashes($this->prod_name)."',                     prod_code   = '".addslashes($this->prod_code)."',                     prod_image  = '',                     prod_weight = '".addslashes($this->prod_weight)."',                     prod_type   = '".$this->prod_type."',                     prod_desc   = '".addslashes($this->prod_desc)."',                     prod_price  = '".$this->prod_price."',                     prod_stock  = '".$this->prod_stock."',                     prod_status = '".$this->prod_status."'";              $this->connect->executequery($query, $this->connect->conn);             $this->last_insert_id = $this->connect->insert_id;              // saving image                 if($this->prod_image['name'])                     $this->prod_image_name = $this->saveproductimage();                  $query = "update tbl_product set                 prod_image = '".$this->prod_image_name."' prod_id =".$this->last_insert_id;                     $this->connect->executequery($query, $this->connect->conn);               $this->setmessage("product has been addedd successfully!", "success");             header("refresh:1; url=index.php?cnt=product&act=list&rs=1");         }      } else if($this->action == "edit") {          $image = "";          // update image check if new image availbale can call function           if($this->prod_image['name']) {             $this->prod_image_name = $this->saveproductimage();             $image = "prod_image   = '".$this->prod_image_name."',";         }          // edit product details         $query = "update tbl_product set                 prod_name   = '".addslashes($this->prod_name)."',                 prod_code   = '".addslashes($this->prod_code)."',                 ".$image."                 prod_weight = '".addslashes($this->prod_weight)."',                 prod_type   = '".$this->prod_type."',                 prod_desc   = '".addslashes($this->prod_desc)."',                 prod_price  = '".$this->prod_price."',                 prod_stock  = '".$this->prod_stock."',                 prod_status = '".$this->prod_status."' prod_id = '".$this->prod_id."' limit 1";         $this->connect->executequery($query, $this->connect->conn);          $this->setmessage("product details has been edited successfully!", "success");         header("refresh:1; url=index.php?cnt=product&act=list&rs=1");     } }      // save product image function saveproductimage() {     $imagename = "";      $temppath = $this->prod_image['tmp_name'];     $extention = explode("/",$this->prod_image['type']);     if(isset($this->last_insert_id))                 $imagename = $this->last_insert_id."_".time().".".$extention[1];     else         $imagename = $this->prod_id."_".time().".".$extention[1];      $filepath = product_upload_dir.$imagename;      if($this->prod_image_name)         if(file_exists(product_upload_dir.$this->prod_image_name))             unlink(product_upload_dir.$this->prod_image_name);      move_uploaded_file($temppath,$filepath);      return $imagename; } 

instead of

header("refresh:1; url=index.php?cnt=product&act=list&rs=1"); 

use

sleep(1); header("location: /index.php?cnt=product&act=list&rs=1"); 

Comments