Hi All,

I am using php to create a Webservice API calls.
I am checking all the service calls in Chrome's Postman and sending the data in JSON format.
I want to upload an image in JSON format with other datas.Actually I have converted the image to base64 before uploading.Its working fine.But I have found in some posts , there may be a chance of data loss if we upload High definition images.

I want to know that is there any other way to upload images as JSON in postman.

Hi,

data loss means a file corruption because the server misses some packets from the transmission (for example caused by a timeout), in this case the uploaded file will result corrupted and the server will return an error because the received length is not the same of what was declared by the Content-Length header. So in this case the API should return an error code.

This does not depend on JSON, depends on the HTTP protocol.

Or you mean that the service will reduce compress high-res files? I now that Picasa does something similar with free accounts.

While this does not solve your question, compressing the base64 string might reduce errors caused by timeout of big files transfer.
Note that because base64 is string then your problem isn't JSON but how to reliably post big data!

That being said, make sure that your server supports image data max size limit. I would accept json field telling me of data size and send error if that size exceeds my limit.

http://stackoverflow.com/questions/22329481/compressing-base64-data-uri-images

Just an update to my previous post (besides I think I got a downvote for this typo haha): I wrote about Google Picasa but I intended Google Photos, which has two storage types: High Quality and Original, the first type will reduce the size of images bigger than 16MP (mega pixels):

If the camera takes photos with a resolution higher than 16 MP, then photos will be downsized to 16 MP.

the second won't reduce the images, but free storage is limited. Source:

Sorry for that, bye! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.