begin yet another rehash of the upload function