Fixed upload function.