Thanks again to all for your patience and support !
I finally got it working this way - it's possible to directly upload a WebCamera-Image to the sparkle-server now.
procedure TForm1.btnSnapShotClick(Sender: TObject);
begin
WebImageControl1.URL := WebCamera1.SnapShotAsBase64;
end;
procedure TForm1.WebButton1Click(Sender: TObject);
var
formData: JSValue;
lmaxfsize: LongInt;
FileContent: TJSArrayBuffer;
begin
mem_Summary.Lines.Clear;
FileContent := WEBLib.Utils.Base64ToArrayBuffer(WebImageControl1.Base64Image);
asm
formData = new FormData();
formData.append('doctyp', document.getElementById('exampledoctyp').value);
formData.append('emailAddress', document.getElementById('exampleInputEmail1').value);
var blob = new Blob([new Uint8Array(FileContent)], { type: 'image/png' });
formData.append('fileUpload', blob,'a.png');
end;
xhr := TJSXMLHttpRequest.new;
xhr.open('POST', 'http://localhost:2001/tms/sparkle/upload');
xhr.upload.addEventListener('loadend', @_loadend);
xhr.upload.addEventListener('progress',@_progress);
xhr.upload.addEventListener('error', @_error);
xhr.upload.addEventListener('timeout', @_timeout);
xhr.upload.addEventListener('abort', @_abort);
xhr.addEventListener('loadend', @_final);
xhr.send(formData);
end;
For details also see
[File Upload Example - WEB / TMS WEB Core - TMS Support Center (tmssoftware.com)]
Regards, Tom