#1521 REST media uploads

Uses the REST API when available to upload media.

Includes #1720