def add_file(self, fieldname, pathname, mimetype=None, filename=None):
        """Add a file section.

        The file will be uploaded. You must use the full path name.

        Args:
            fieldname:  name of the form field.
             pahtname:  Full path to the file.
             mimetype:  Override the auto-detected mime type.
             filename:  Override the base name of the given pathname.
        """
        plist = [pycurl.FORM_FILE, pathname]
        if mimetype:
            plist.append(pycurl.FORM_CONTENTTYPE)
            plist.append(mimetype)
        if filename:
            plist.append(pycurl.FORM_FILENAME)
            plist.append(filename)
        if fieldname in self:
            dict.__setitem__(self, fieldname, self[fieldname] + tuple(plist))
        else:
            dict.__setitem__(self, fieldname, tuple(plist))
dataset/ETHPy150Open kdart/pycopia/WWW/pycopia/WWW/client.py/HTTPForm.add_file/original