clean up/fix whole-file upload handler