working on upload function