modify upload function