最近在为自己的博客增加一个头像编辑系统,看见这个插件很不错http://asv5.sinaapp.com/widget/avatar.php#step1 就直接拿来用了。但是这个插件上传图片的方式是将图片以xml类型的二进制文件形式POST请求的方式请求到另一个url。为了接收图片,我该怎么接受这个二进制的POST请求?插件的制作者给出了php的实现方案http://www.cnblogs.com/meteoric_cry/archive/2011/06/18/2084371.html 。但是并不清楚在flask下如何实现。。
Use request.data. If you can’t receive it, pay attention to the file header. Then use a parser to parse the xml and extract the image.
After thinking about it, the fundamental problem of this problem is how does flask get the original data of the POST request? I tried request.data and it seems that I can't get the binary data. .