Fix a longstanding bug when storing a media file with an empty `upload_name`.