upload function is good, but needs further modification