Image Not Display on Losant Files using custom applications mode

Hi, I am trying to save the device image in a losant file using a custom application. the image saves on losant application successfully but I am viewing the image it does not display the image it shows a blank page.what is the problem please fix these issues.!

losant_file|690x353

File Create Node

@Raghu_S1,

To help me debug, I have a couple follow up questions:

  1. What is the value of {{data.body.image.data}}?

  2. You mention “the image saves on losant application successfully”. Can you please upload the file you were able to save successfully?

Hi anaptfox ,

I have been too saved image data to two formats Base64 and UTF8,

Base64 format Data:

UTF format Data:

After saving the file on losant files the result payload like this.

And finally view the image in losant files not displayed

@anaptfox facing the same issue here. Might be an implementation problem but difficult to debug whats going wrong. We are uploading a buffer file data. Is that supported?

Screenshot attached.

@Raghu_S1 were you able to debug this?

@Suroor_Wijdan,

The file is making it to the workflow properly. Now, you need to convert the Buffer to a format that the File Create Node accepts for file creation. In the example workflow we’ve attached, we are using function node to encode the buffer to base64. The screenshots below show the additional Function Node you’ll need, as well as the JavaScript code block for configuring that node.

With the function code block containing the following:

payload.working = payload.working || {}
payload.working.base64Image = new Buffer(payload.data.body.fileData.data).toString('base64');

get-upload-develop.flow (4.5 KB)

The File Create node supports base64:

Hopefully these docs and example workflow are helpful.

Let us know if we can assist further,
@Aidan_Zebertavage

Thanks @Aidan_Zebertavage. This was very helpful. I did initially think that file create node doesn’t accept binary data. Should have evaluated the function node. :slight_smile:

@Suroor_Wijdan,

No problem - that’s why we are here!

Thanks,
@Aidan_Zebertavage

1 Like