PAHMA-979: code cleanup uploadMedia.py