'Parse the request, returning a DataAndFiles object with the data dict
left empty, and the body of the request placed in files[\'file\'].'

def parse(self, stream, media_type=None, parser_context=None):

    upload_media_types = getattr(parser_context['view'], 'upload_media_types', set())
    if (media_type not in upload_media_types):
        raise UnsupportedMediaType(media_type)
    filename = self.get_filename(stream, media_type, parser_context)
    if (media_type in self.file_extensions):
        fileparts = filename.rsplit('.', 1)
        if (len(fileparts) < 2):
            ext = ''
        else:
            ext = '.{}'.format(fileparts[1])
        if (ext.lower() not in self.file_extensions[media_type]):
            errmsg = u'File    extension    does    not    match    requested    Content-type.    Filename:    "{filename}",    Content-type:    "{contenttype}"'
            raise ParseError(errmsg.format(filename=filename, contenttype=media_type))
    return super(TypedFileUploadParser, self).parse(stream, media_type, parser_context)
