Factor uploadImage into plugin where it can be overriden.

This just moves around code in a way that allows you to override the uploadImage call in the plugin, and do something other than the default.