Hi Thys,
>> But now with a Clarion client doing the file upload, I don't know how to base64 encode the file content before it is uploaded. In the server side's ServiceMethod routine, I use the following code:
You don't need to base64 encode the upload.
Let's back up a bit.
There are (at least) 3 ways for a client to send data to the server.
a) Form Encoded
b) as an XML payload
c) as Json payload.
when you do this;
nt.SetValue ('FileContent', GLO:FileName, true)
nt.SetValue ('FileExtension', GLO:Extension)
nt.Post (GLO:URL, '')
All the work is done for you, and the payload is in "form encoded" mode.
On the server side, you set the parameter to FILE.
This places the incoming file into a StringTheory object, already in Binary form. If you want to save it to disk you can do;
FileContent.SaveFile (clip (p_web.site.UploadsPath) & '\' & DocumentID)
There is no need to base64 decode it, since it was never base64 encoded in the first place.
IF you are uploading XML or JSON (which you are not doing, nor do you need to do it) then the field would be base64 encoded, but if you were constructing XML or JSON there are then techniques to do that. If that was the case the server would _still_ not need to do a Base64 Decode - that would be done automaticlly for you, and the code to save the file would remain as
FileContent.SaveFile (clip (p_web.site.UploadsPath) & '\' & DocumentID)
cheers
Bruce