Question

I'm using this javascript library (http://valums.com/ajax-upload/) to upload file to a tornado web server, but I don't know how to get the file content. The javascript library is uploading using XHR, so I assume I have to read the raw post data to get the file content. But I don't know how to do it with Tornado. Their documentation doesn't help with this, as usual :(

In php they have something like this:

$input = fopen("php://input", "r");

so what's the equivalence in tornado?

Was it helpful?

Solution

I got the answer.

I need to use self.request.body to get the raw post data.

I also need to pass in the correct _xsrf token, otherwise tornado will fire a 403 exception.

So that's about it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top