I implemented drag'n'drop into browser window upload and also had to
retrieve the whole request body
I think this bit of code should be used before web.input (i use
web.input after to parse GET parameters)

tmpfile = os.tmpfile()
        contentLength = int(web.ctx.env['CONTENT_LENGTH'])
        if contentLength <= 0:
            raise AssertionError('invalid content length')
        wsgiInput = web.ctx.env['wsgi.input']
        while contentLength > 0:
            chunk = 1024
            if contentLength < chunk:
                chunk = contentLength
            contentLength -= chunk
            tmpfile.write(wsgiInput.read(chunk))
        tmpfile.seek(0)
web.ctx.env['wsgi.input'] = StringIO()


On Jul 13, 7:30 pm, Mynnx <[email protected]> wrote:
> I am trying to instantiate a Paste WebOb Request object, which needs a
> WSGI environ variable.  I noticed that once I do so, there is nothing
> in the request's 'body' field, even when I'm certain the request
> POSTed data.
>
> I would assume that it uses the environ variable 'wsgi.input' to get
> the body - according to PEP333 it is "an input stream (file-like
> object) from which the HTTP request body can be read."  I've tried
> calling .read() on web.ctx.env['wsgi.input'], but nothing is read.
> Does webpy populate it correctly?

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to