Upload Binary Helper

uploadBinaryHelper(datasource, imageBase64, name, type)

The uploadBinaryHelper helps with uploading binary files. The Picture Upload sample app shows how to use this function.

Parameters

The function has the following parameters:

Parameter

Description

Required

datasource

An Appery.io REST service instance with POST method to create a file in Files collection.

Yes.

imageBase64

A base64 string of the image.

Yes.

name

A name with which file will be stored. If empty, current date will be used as name.

No.

type

Image format as .jpg or .png. If empty .jpg is used.

No.

Example

In the following example web_upload is the name of a service instance on a page, and image_base64 is a local storage variable that stores the image in base64 format.

uploadBinaryHelper(web_upload, Apperyio.storage.image_base64.get());