Cleanup image upload function