Clean up ph_upload so that it doesn't use a callback