Updated the logic after a user selects media to upload.