Neater implementation of upload