preg_match("/\\.(gif|bmp|png|jpg|jpeg|pdf){1}\$/i", $file_anexo["name"], $ext);
        // Gera um nome único para a imagem
        $imagem_nome = $id . '_' . $controle_id_usuario . md5(uniqid(time())) . "." . $ext[1];
        // Caminho de onde a imagem ficará
        $imagem_dir = $file_path . $imagem_nome;
        // Faz o upload da imagem
        move_uploaded_file($file_anexo["tmp_name"], $imagem_dir);
    }
    $error .= '</ul>';
    $a = new stdClass();
    $a->descricao = $descricao;
    $a->anexo = $imagem_dir;
    $a->id_cliente = $id;
    $a->id_empresa = $controle_id_empresa;
    if (count($errors) == 0) {
        $f_insert = $clienteDAO->inserirAnexo($a);
        ?>
 <script type="text/javascript">
			alert('Documento anexado com sucesso!');
		</script> <?php 
    }
}
pt_register('POST', 'submit');
if ($submit) {
    //check for errors
    $error = "";
    $errors = array();
    $error = "<b>Ocorreram os seguintes erros:</b><ul>";
    pt_register('POST', 'nome');
    pt_register('POST', 'tel2');
    pt_register('POST', 'tel');