TBytes array in post request
Posted: Tue Feb 11, 2020 9:22 am
Good afternoon. Please tell me whether it is possible to add an array of TBytes to the POST request. The bottom line is, under certain conditions, the program takes a picture of its window, which is encoded in the webp format and as a result we get the TBytes array. This array must be transferred to the server in a specific request. I catch this request in the onBeforeResourceLoad event:
Can I add a Screen variable here in PostData? And can this be done without saving Screen to a file?
Thanks for the help.
Code: Select all
var Screen: TBytes //global variable
//..
procedure onBeforeResourceLoad(...)
begin
//...
if [some condition] then
begin
request.Method := 'POST';
request.SetHeaderByName('Content-Type','application/x-www-form-urlencoded',true);
if not Assigned(request.PostData) then
request.PostData := TCefPostDataRef.New;
request.PostData.AddElement(CreateField('url=' + ReportData.CurrentURL));
//insert TBytes here "Screen"
end;
end;
Thanks for the help.