We describe flat covers and cotorsion envelopes over formal triangular matrix rings. To describe the flat covers we use Quillen factorizations of linear maps relative to the classical cotorsion pair. Using flat covers over formal triangular matrix rings we prove the existence and minimality of Quillen factorization.