使用Kinvey Rest API进行文件存储 [英] File Storeage Using Kinvey Rest api
问题描述
我尝试使用KINVEY REST api( http://devcenter.kinvey上传图片. com/rest/guides/files#Uploading )
I try to upload image using KINVEY REST api (http://devcenter.kinvey.com/rest/guides/files#Uploading)
但是我无法上传文件存储中的文件.
but i failed to upload file in file storage.
请告诉我如何在get/put请求中发送图像文件名/文件数据,以及 我应该使用哪个标题.
please tell me how to send image file-name/file-data in get/put request and which header should i use.
也请参阅对我有帮助的任何链接.
also refer any link which help me.
提前谢谢.
推荐答案
我是Kinvey的工程师.要使用REST API,您首先需要通过向以下位置发出GET请求来获取要上传的API URL:
I'm an engineer at Kinvey. To use the REST API, you need to first get an API URL to upload by making a GET request to:
/blob/:appKey/upload-loc/:fileName
这将返回带有以下对象的响应:
That will return a response with the following object:
{ "URI" : <externalLocation> }
提取response.body.URI,并对该URI执行PUT请求.设置content-length标头,并将您的二进制文件作为request.body传递.
Exctract response.body.URI, and perform a PUT request to that URI. Set the content-length header, and pass your binary file as the request.body.
关于文件上传的一些注意事项:
A couple of notes about file upload:
- upload-loc检索的URI仅有效30秒
- 该库仅支持文件<大小为64 MB.
这篇关于使用Kinvey Rest API进行文件存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!