Let $BE$ and $CF$ be altitudes in triangle $ABC$. If $AE = 24$, $EC = 60$, and $BF = 31$, determine $AF$.
Given that $BE$ and $CF$ are altitudes in triangle $ABC$, and $AE = 24$, $EC = 60$, and $BF = 31$, we need to determine $AF$.

We will use the Power of a Point theorem, which states that for a point $P$ outside a circle, the product of the lengths of the segments of any two secants drawn from $P$ to the circle is equal. In this case, we will consider the cyclic quadrilateral formed by the points $B, E, F, C$.

Let $AF = y$.

### Case 1: $\angle A < 90^\circ$
If $\angle A < 90^\circ$, then $BFEC$ is cyclic. By the Power of a Point theorem:
\[ AF \cdot AB = AE \cdot AC \]

We know:
\[ AE = 24, \quad EC = 60, \quad BF = 31 \]

Let $AB = y + 31$ and $AC = 24 + 60 = 84$.

Thus, we have:
\[ y(y + 31) = 24 \cdot 84 \]

Calculating the right-hand side:
\[ 24 \cdot 84 = 2016 \]

So, the equation becomes:
\[ y^2 + 31y = 2016 \]

This is a quadratic equation:
\[ y^2 + 31y - 2016 = 0 \]

We solve this quadratic equation using the quadratic formula:
\[ y = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]
where \( a = 1 \), \( b = 31 \), and \( c = -2016 \).

\[ y = \frac{-31 \pm \sqrt{31^2 - 4 \cdot 1 \cdot (-2016)}}{2 \cdot 1} \]
\[ y = \frac{-31 \pm \sqrt{961 + 8064}}{2} \]
\[ y = \frac{-31 \pm \sqrt{9025}}{2} \]
\[ y = \frac{-31 \pm 95}{2} \]

This gives us two solutions:
\[ y = \frac{64}{2} = 32 \]
\[ y = \frac{-126}{2} = -63 \]

Since $y$ represents a length, it must be positive:
\[ y = 32 \]

### Case 2: $\angle A > 90^\circ$
If $\angle A > 90^\circ$, then $BEFC$ is cyclic. By the Power of a Point theorem:
\[ AF \cdot AB = AE \cdot AC \]

We know:
\[ AE = 24, \quad EC = 60, \quad BF = 31 \]

Let $AB = 31 - y$ and $AC = 60 - 24 = 36$.

Thus, we have:
\[ y(31 - y) = 24 \cdot 36 \]

Calculating the right-hand side:
\[ 24 \cdot 36 = 864 \]

So, the equation becomes:
\[ 31y - y^2 = 864 \]

Rewriting it as a quadratic equation:
\[ y^2 - 31y + 864 = 0 \]

We solve this quadratic equation using the quadratic formula:
\[ y = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]
where \( a = 1 \), \( b = -31 \), and \( c = 864 \).

\[ y = \frac{31 \pm \sqrt{31^2 - 4 \cdot 1 \cdot 864}}{2 \cdot 1} \]
\[ y = \frac{31 \pm \sqrt{961 - 3456}}{2} \]
\[ y = \frac{31 \pm \sqrt{-2495}}{2} \]

Since the discriminant is negative, there are no real solutions for this case.

Therefore, the only valid solution is from Case 1.

The final answer is $\boxed{32}$.