Hi all,
I've build a codeunit that runs a report and save that as an xlsx. After that it must be uploaded to a webserver.
I can do a HTTP request using the Automation object "Microsoft XML, v6.0.XMLHTTP60" but it seems that it only supports text.
Than I tried to convert the file to a base64 string by using the DotNet mscorlib System.Convert component but it don't work and hangs on a "Ambiguous function call, no matching method found" error. That error can occur when the function have nullable fields. I don't know how to resolve that.
So, does someone know how to upload a file using HTTP? I'm stuck for 3 days now.
Many thanks in advance
0
Answers
I've used System.Convert.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' for same purpose with success like this:
---
XMLElementField := XMLDocument.CreateElement(Name2XMLEntry(ElementName));
IF EXISTS(URL) THEN BEGIN
PictureFile.OPEN(URL);
PictureFile.CREATEINSTREAM(InStream);
MemoryStream := MemoryStream.MemoryStream;
COPYSTREAM(MemoryStream, InStream);
XMLElementField.AppendChild(XMLDocument.CreateTextNode(Convert.ToBase64String(MemoryStream.GetBuffer)));
END;
XMLElementTable.AppendChild(XMLElementField);
---
I also use:
System.IO.MemoryStream.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'