Add checks to the image upload script.

Use str and not img when creating POST body