fix/improve logic for listing available upload dirs