'Saves an image File
:param data: FileStorage from Flask form upload field
:param filename: Filename with full path'

def save_file(self, data, filename, size=None, thumbnail_size=None):

    max_size = (size or self.max_size)
    thumbnail_size = (thumbnail_size or self.thumbnail_size)
    if (data and isinstance(data, FileStorage)):
        try:
            self.image = Image.open(data)
        except Exception as e:
            raise ValidationError(('Invalid    image:    %s' % e))
    path = self.get_path(filename)
    if (not op.exists(op.dirname(path))):
        os.makedirs(os.path.dirname(path), self.permission)
    (filename, format) = self.get_save_format(filename, self.image)
    if (self.image and ((self.image.format != format) or max_size)):
        if max_size:
            image = self.resize(self.image, max_size)
        else:
            image = self.image
        self.save_image(image, self.get_path(filename), format)
    else:
        data.seek(0)
        data.save(path)
    self.save_thumbnail(data, filename, format, thumbnail_size)
    return filename
