Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我create()在 django-piston 中定义了一个方法。我需要能够接收并使用 JSON 格式的描述进行图像处理。怎么做?是否应该在两个单独的 HTTP 请求中处理它们?
create()
我建议将您的文件作为多部分编码的形式发布,就像您通过表单上传文件时您的网络浏览器所做的那样。使用多部分编码,您可以将文件作为表单中的二进制数据元素发送(比在 JSON 中对 JPG 进行 BASE64 编码要好得多),然后是另一个包含 JSON 数据的元素。这是一个请求。有很多库可以解析这种形式的东西,所以很容易做到。