First tentative of simplifying the ton of "if" conditions that handle media upload.