if ($id == 0) {
        // insert
        $obj = new ColorImage();
        $obj->ColorId = $_REQUEST["color"];
        $obj->create();
        $obj->handleFileUploads();
        $obj->handleDropFileUploads($aDropFields[0], 'ImageFile');
        // redirect to listing list
        header("Location:colorimage_list.php?cat=" . $_REQUEST['cat'] . "&color=" . $_REQUEST['color']);
        exit;
    } else {
        // update
        $obj = new ColorImage($id);
        $obj->update();
        $obj->handleFileUploads();
        $obj->handleDropFileUploads($aDropFields[0], 'ImageFile');
        // redirect to listing list
        header("Location:colorimage_list.php?cat=" . $_REQUEST['cat'] . "&color=" . $_REQUEST['color']);
        exit;
    }
} else {
    if ($_REQUEST['mode'] == 'e') {
        //listing
        $objColorImage = new ColorImage($id);
        $color_id = $objColorImage->ColorId;
        $image_file = $objColorImage->ImageFile;
        $path = $objColorImage->GetPath();
    } else {
        if ($_REQUEST['mode'] == 'a') {
            $color_id = $_REQUEST["color"];
        }