1

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.

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.

thanks in advance.

xhah730
  • 13
  • 4

1 Answers1

1

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

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:

  • The URI retrieved by upload-loc is only valid for 30 seconds
  • The library only supports files < 64 MB in size.
mjsalinger
  • 660
  • 6
  • 17
  • thanks mjsalinger, but it will really helpful if you give me a sample of PUT request specially request body part. – xhah730 May 22 '13 at 14:35
  • can you tell me how to send file data in request body my data is like data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEB..... – xhah730 May 22 '13 at 18:04
  • setting the content-length header causes problems in many browsers. Can you provide some info on that ? – daksh_019 Jul 30 '16 at 09:30