function oos_copy_uploaded_file($filename, $target) {
  if (substr($target, -1) != '/') $target .= '/';
  if (OOS_RANDOM_PICTURE_NAME == '1') {
    $picture_tempname = oos_get_random_picture_name(26);
    $picture_tempname .= '.';
    $picture_tempname .= MyOOS_Utilities::getFileExtension($filename['name']);
  } else {
    $picture_tempname = $filename['name'];
  }
  $picture_name = oos_str_strip_all($picture_tempname);
  // Big Image
  // path for big image:
  $target_big = $target . OOS_POPUP_IMAGES;
  // If !path make it, if you have problems remove the line
  // if (!is_dir($target_big)) mkdir($target_big,0777);

  // Resize Big image
  $target_big .= $picture_name;
  if (OOS_WATERMARK == '1') {
    oos_watermark ($filename['tmp_name'], $target_big, OOS_WATERMARK_QUALITY);
  } else {
    if (OOS_BIGIMAGE_WIDTH || OOS_BIGIMAGE_HEIGHT ) {
      oos_resize_image($filename['tmp_name'], $target_big, OOS_BIGIMAGE_WIDTH, OOS_BIGIMAGE_HEIGHT, OOS_BIGIMAGE_WAY_OF_RESIZE);
    } else {
      copy($filename['tmp_name'], $target_big);
    }
  }

  $target_small = $target . $picture_name;
  oos_resize_image($filename['tmp_name'], $target_small, OOS_SMALL_IMAGE_WIDTH, OOS_SMALL_IMAGE_HEIGHT, OOS_SMALLIMAGE_WAY_OF_RESIZE);

  return $picture_name;
}
               . " SET customers_image = ?"
               . " WHERE customers_id = ?";
        $result =& $dbconn->Execute($query, array('', (int)$_SESSION['customer_id']));
    }

    require_once 'includes/classes/class_upload.php';

    if (!empty($_FILES['id']['tmp_name']) and ($_FILES['id']['tmp_name'] != 'none')) {

        $customers_image_file = new upload('id');
        $customers_image_file->set_destination(OOS_ABSOLUTE_PATH . OOS_IMAGES . OOS_CUSTOMERS_IMAGES);

        if ($customers_image_file->parse()) {
            if (isset($_SESSION['customer_id'])) {

                $extension = MyOOS_Utilities::getFileExtension($_FILES['id']['name']);
                $picture_tempname = oos_get_random_picture_name(26, $extension);
                $customers_image_file->set_filename($picture_tempname);

                $customerstable = $oostable['customers'];
                $query = "UPDATE $customerstable"
                       . " SET customers_image = ?"
                       . " WHERE customers_id = ?";
                $result =& $dbconn->Execute($query, array((string)$picture_tempname, (int)$_SESSION['customer_id']));

               $customers_image_file->save();
            }
        }
    }
}