Write images from app to local server
This tutorial explains how to share images taken inside an app with a local server or PC using the photo widget, an agent and the writeBufferToFile function.
Last updated
Was this helpful?
This tutorial explains how to share images taken inside an app with a local server or PC using the photo widget, an agent and the writeBufferToFile function.
Download an agent with file connector and start the agent on the server or PC you want to store the images.
Pick the photo widget from input widgets and place it into the user interface of your app. Switch the storage type of the photo widget from file to buffer.
Use a memory function to get images from the photo widget by connecting the photo widget with the memory functions input. Also, add two JSONata modifiers to the memory to extract the base64 buffer string and prepare the path and file name.
These are the JSONata snippets to use in your modifiers. Replace the path from the example with the path on your server where you want to store the images. All backslashes must be doubled to be working with JSONata syntax.
'C:\\Users\\gerri\\Desktop\\Demo\\Images' & '\\' & name & '.jpeg'base64The final memory function, after taking a photo in test mode, must look like in the screenshot below.

Find the writeBufferToFile function inside your file connector agent that should have appeared in the functionality panel and drag it onto the canvas.
Connect the path modifier with the filePath input and the buffer modifier with the buffer input.

Last updated
Was this helpful?
Was this helpful?