The ability to engineer the spatial wavefunction of photons has enabled a variety of quantum protocols for communication, sensing, and information processing. These protocols exploit the high dimensionality of structured light enabling the encodinng of multiple bits of information in a single photon, the measurement of small physical parameters, and the achievement of unprecedented levels of security in schemes for cryptography. Unfortunately, the potential of structured light has been restrained to free-space platforms in which the spatial profile of photons is preserved. Here, we make an important step forward to using structured light for fiber optical communication. We introduce a smart high-dimensional encryption protocol in which the propagation of spatial modes in multimode fibers is used as a natural mechanism for encryption. This provides a secure communication channel for data transmission. The information encoded in spatial modes is retrieved using artificial neural networks, which are trained from the intensity distributions of experimentally detected spatial modes. Our on-fiber communication platform allows us to use spatial modes of light for high-dimensional bit-by-bit and byte-by-byte encoding. This protocol enables one to recover messages and images with almost perfect accuracy. Our smart protocol for high-dimensional optical encryption in optical fibers has key implications for quantum technologies relying on structured fields of light, particularly those that are challenged by free-space propagation.