Ejemplo n.º 1
0
function update_logo()
{
    // Update logo.
    $s = Jaring::request_upload_check_err("logo");
    if (false === $s) {
        if ($_FILES["logo"]["error"] === UPLOAD_ERR_NO_FILE) {
            return true;
        }
        return false;
    }
    $id = $_POST["id"];
    $q = "update _profile set logo_type = ? , logo = ? where id = ?";
    Jaring::$_db_ps = Jaring::$_db->prepare($q);
    $fp = fopen($_FILES["logo"]["tmp_name"], "rb");
    $i = 1;
    Jaring::$_db_ps->bindParam($i++, $_FILES["logo"]["type"]);
    Jaring::$_db_ps->bindParam($i++, $fp, PDO::PARAM_LOB);
    Jaring::$_db_ps->bindParam($i++, $id);
    Jaring::$_db_ps->execute();
    return true;
}