def create(self, datastore_id=None):
        """POST /datastores/{datastore_id}/datasources: Create a new
        datasource by file upload."""

        datastore = self._get_ogrdatastore_by_id(datastore_id)
        if not datastore:
            abort(404)

        # only "directory" datastores are supported at this point
        if datastore.connection_type != 'directory':
            abort(400)

        # use mkstemp to store the file to avoid issues with
        # NamedTemporaryFile that can't be open a second time
        # on Windows. See:
        # http://docs.python.org/library/tempfile.html#tempfile.NamedTemporaryFile
        # "Whether the name can be used to open the file a second time, while the
        # named temporary file is still open, varies across platforms (it can be so
        # used on Unix; it cannot on Windows NT or later).
        fd, fn = mkstemp()
        tmpfile = os.fdopen(fd, 'wb')
        fieldstorage = request.POST['datasources']
        shutil.copyfileobj(fieldstorage.file, tmpfile)
        fieldstorage.file.close()
        tmpfile.close()

        extractall(fn,
                   request.POST['datasources'].filename,
                   datastore.datastore_str)

        # we are reponsible for removing the temporary file
        os.remove(fn)

        response.status = 201