

def _handle_uploaded_file(self, field_name):
    'Process an uploaded file'
    try:
        file = self.files[field_name]
        filepath = self._get_upload_name(file.name)
    except KeyError:
        return ''
    destination = open((settings.MEDIA_ROOT + filepath), 'wb+')
    for chunk in file.chunks():
        destination.write(chunk)
    destination.close()
    return (settings.MEDIA_URL + filepath)

dataset/ETHPy150Open treeio/treeio/treeio/identities/forms.py ContactForm._handle_uploaded_file/original