debug the upload function