I manage to make the code to work:
// Show image before Upload
// 'foto' is the name of the image Appery component
// 'file_name' is the name of the input file Appery component
// get a reference to the image photo holder
var preview = Appery("foto")[ 0 ];
// get a reference to the file input
var file = Apperyio("file_input")[ 0 ].files[0];
var reader = new FileReader();
reader.addEventListener("load", function ()
{
preview.src = reader.result; // show image
}, false);
if (file)
{
reader.readAsDataURL(file);
}
if the user is ok with the image it then uses a upload button to upload the selected image to the database using
uploadMultipleFilesHelper(uploadService, Apperyio('file_input'));