Se $row["tipo"] ha il valore XX allora $file altrettanto. Quindi ti stamperà a video XX.pdf. Provare per credere.