Modify upload function