Hi Christian,
as I told, there's a frontend BaseX that receives requests from an HTML page (on port 9984) and forwards them to another BaseX instance that acts as backend service (port 8984). Up to receiving the Image from the page on the first BaseX and writing it to disk everything is fine for me too.
When sending the Image through http:send-request as http post body it gets serialized as base64 encoded.
I then replaced the second BaseX with an nc -l on port 10000 in order to educe the example and to ensure that the encoding occurs while sending and not on the receiving end. nc -l logs the incoming request and I have been able to verify that the post body arrives already as base64 encoded.
The code I sent is the smallest example I have been able to produce.
Sorry but I'm really not able to explain it differently.
Regards,
Marco.
Hi Marco,
I’m confused: Are you working with two BaseX instances (one running on
port 9984, one running on 10000)? Is there any chance to simplify this
example and simulate the issue with a single BaseX instance? If not,
could you please give me full advice what needs to be done to get it
working?
I simplified your first function to…
declare %basex:inline function ssce:upload-impl($name as xs:string, $data as
item()){
file:write-binary(file:temp-dir() || $name, $data)
};
…and the binary file was correctly stored to disk.
Cheers
Christian