python - flask如何获取POST过来的xml类型的二进制文件?
黄舟
黄舟 2017-04-17 15:14:30
0
2
396

最近在为自己的博客增加一个头像编辑系统,看见这个插件很不错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下如何实现。。

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
Peter_Zhu

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. .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!