简体   繁体   中英

asynchronous file upload with ajaxupload to a tornado web server

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM