[fpc-pascal] Prorammatically sending file using HTTP POST?
bo.berglund at gmail.com
Wed Apr 4 17:50:40 CEST 2018
On Wed, 4 Apr 2018 17:09:49 +0200 (CEST), Michael Van Canneyt
<michael at freepascal.org> wrote:
>I don't know what a 'good example' is for you, but the code in
>Is quite understandable.
I found this example too, but it seems to be dealing with *server*
I am trying to create a *client* function which will send a POST
command like a browser would when I click the submit button on the
simple form I showed the source for.
It works fine if I use the web browser to connect and load the form,
then select the file and finally hit the submit button.
But since I already have all of the other device config items inside
an FPC program I wanted the firmware upload to also be part of it...
This is how far I have gotten with the UploadFirmware method:
function TConfigCommHandler.UploadFirmware(FileName: string; URL:
Result := false;
if not FileExists(FileName) then exit;
HTTP := TIdHTTP.Create;
Src := TIdMultipartFormDataStream.Create;
HTTP.Post(URL, Src, ?);
Result := true;
on E: Exception do
FLastError := 'Exception: ' + E.Message;
It is all about formulating the correct parameters towards the
Developer in Sweden
More information about the fpc-pascal