Added checks to make sure user is uploading an image, and added tests.