This is probably going to be a stupid question but I'm having one of those nights.
(这可能是一个愚蠢的问题,但是我有一个夜晚。)
In an application I am developing RESTful API and we want the client to send data as JSON. (在一个应用程序中,我正在开发RESTful API,我们希望客户端将数据作为JSON发送。)
Part of this application requires the client to upload a file (usually an image) as well as information about the image. (此应用程序的一部分要求客户端上载文件(通常是图像)以及有关该图像的信息。)
I'm having a hard time tracking down how this happens in a single request.
(我很难追踪单个请求中的情况。)
Is it possible to Base64 the file data into a JSON string? (是否可以将文件数据Base64转换为JSON字符串?)
Am I going to need to perform 2 posts to the server? (我需要在服务器上执行2个帖子吗?)
Should I not be using JSON for this? (我不应该为此使用JSON吗?)
As a side note, we're using Grails on the backend and these services are accessed by native mobile clients (iPhone, Android, etc), if any of that makes a difference.
(附带说明一下,我们在后端使用Grails,并且本机移动客户端(iPhone,Android等)可以访问这些服务(如果有区别的话)。)
ask by Gregg translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…