How to save a photo to server which is newly taken on client

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

How to save a photo to server which is newly taken on client

Post by MegumiSawada » Fri Jun 03, 2016 5:58 pm

Hi,

The customer is using LANSA Mobile.
They would like to take a photo, show it on image control on Web page,and save it to the sever.

I have succeeded in take a photo and show it on image control on the web page (Base 64 encoded).
#Image1.FileName := "data:image/png;base64," + #CameraUse.ImageAsBase64Data
However, I don't know how to save it to the server.
Is it possible to save it (BASE64 encoded = String type) to BLOB field on a file in the server?
If yes, could you please let me know how to?

Sorry for the basic question.
Thanks in advance.

Best Regards,
Megumi Sawada

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: How to save a photo to server which is newly taken on client

Post by Stewart Marshall » Fri Jun 03, 2016 6:08 pm

Hi Meg

As shown in xDemoWebImageCapture, the selected file needs to be stored in a blob field

Code: Select all

Evtroutine Handling(#FilePicker.FileSelected) File(#File)

#Image.FileName #xDemoblob := #File.Blob

Endroutine
The blob can then be sent to the server the same as any LANSA field. Once there, OV_FILE_SERVICE can be used to manipulate the location of the physical object. This thread provides a little more detail.

http://vlforum.lansa.com.au/viewtopic.p ... RVICE#p176

Regards
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

MegumiSawada
Posts: 45
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: How to save a photo to server which is newly taken on client

Post by MegumiSawada » Tue Jun 07, 2016 2:32 pm

Hi Stewart,

Thank you for your quick reply!
I have managed to save a photo as BLOB...!
Thanks again for your advice.

Best Regards,Megumi

Post Reply