If the possible range of the contents of the file was small enough (either because the file is very short, because the attacker knows all the parts of the file except for a very short item, or because the attacker knows that the contents of the file are part of a limited set.The attacker can then perform a brutal search for the possible contents of the file and check the hash summary of each result to see if it corresponds to the name of the file.
Note that this vulnerability has nothing to do with the fact that MD5 is cryptographically broken and obsolete; any hash function would be vulnerable to the same problem. If you want to avoid this risk, you should either avoid encrypting small / predictable files, or do not let the hash summary of plain text hang in plain text (the file name).
Another attack that could This is possible if the attacker knows at least some of the files you have stored and can generate a new file to store. Because MD5 is broken, the attacker could potentially create a malicious file containing the same MD5 as a file that is important to you, and then when you store the file provided by the attacker, you overwrite your original file as it bears the same name. The use of encryption is unimportant here (except to the extent that it is harder for the attacker to know which files you have stored); this is simply a consequence of file deduplication using an algorithm for which we know how to create collisions and (partial) pre-images. To avoid this risk, do not let a potential attacker know which files you have stored, do not store the files provided by a potential attacker, and / or do not use a secure hash algorithm such as a member SHA2 or SHA3 families.