Hello,
If your object is generalized with System.FileDocument object then refer this : https://forum.mendix.com/link/space/app-development/questions/5623
If your object is associated with System.FileDocument object then , retrieve the FileDocument object via the association and delete it.
Hope it helps!