Handled some exceptions when uploading images