Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-05-03 Thread R0b0t1
On Wed, Apr 4, 2018 at 6:50 AM, Bo Berglund wrote: > I have written a Lazarus/FPC program to configure an IoT device via a > tcp server I have implemented on the device. It all works well for > setting the parameters etc. > Now I want to also add a firmware update function

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-05-03 Thread Klaus Hartnegg
Am 04.04.2018 um 13:50 schrieb Bo Berglund: By the way, I am using the Indy10 components via the indylaz package. Lazarus is 1.8.0 and FPC 3.0.4 on Windows7. If anybody wants to do this just with winsock: const dstport = 80; http_path = '/post.php'; type Int32 = Longint; function

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-25 Thread Bo Berglund
On Sat, 7 Apr 2018 16:09:29 +0100, Graeme Geldenhuys wrote: > I much prefer NNTP newsgroups to the much slower and often ad-driven > web forums, or mailing lists. Plus I can easily download all messages > (dating back to 2006) for offline viewing and searching

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-07 Thread Graeme Geldenhuys
On 2018-04-07 15:32, Alexander Grotewohl wrote: > Those newsgroups are a horrid suggestion. The most recent messages are > from 2016. It seems they only leave it up for posterity. I got personally assured by Remy Lebeau that the NNTP newsgroups are checked just as frequently as the Web Forums.

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-07 Thread Alexander Grotewohl
Those newsgroups are a horrid suggestion. The most recent messages are from 2016. It seems they only leave it up for posterity. On 04/07/2018 05:13 AM, Graeme Geldenhuys wrote: On 2018-04-04 16:05, Bo Berglund wrote: Yes, I use Indy since the Delphi days but I have not used it to send files

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-07 Thread Graeme Geldenhuys
On 2018-04-07 10:20, Graeme Geldenhuys wrote: > And if you are really lazy... ;-) And here's an even simpler version. [ from Remy Lebeau ]- TIdHTTP has two overloaded versions of Post() that take a filename as input: var Response: String; Response :=

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-07 Thread Bo Berglund
On Sat, 7 Apr 2018 10:13:06 +0100, Graeme Geldenhuys wrote: >Have you actually tried asking the question in the official Indy support >newsgroup? > >I've always gotten very quick responses from them. > Well, I asked in the Embarcadero forum (using XanaNews nttp

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-07 Thread Graeme Geldenhuys
On 2018-04-07 10:13, Graeme Geldenhuys wrote: > Have you tried this? > > http://lmgtfy.com/?q=delphi+indy+sending+file+via+http+post > > I see many answers listed there. ;-) And if you are really lazy... ;-) Indy has TIdMultipartFormDataStream for this purpose: procedure

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-07 Thread Graeme Geldenhuys
On 2018-04-04 16:05, Bo Berglund wrote: > Yes, I use Indy since the Delphi days but I have not used it to send > files before. Yes, there is no problem in using Indy with FPC - I've done it for years. So no need to switch components. > Indy has a TIdHTTP object/component, which presumably can be

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-05 Thread Anthony Walter
HTTP is quite simple actually. You just build a post message (a string), and send it over a socket. I've implemented HTTP client functions in many computer languages. Here are the key take aways if you want to implement it yourself. Build this string filling out the blanks using your own values

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-04 Thread Anthony Walter
Just a follow up, if care you get a response back from your POST, as in the server says okay, you just use the same socket to read. Also, you might need to call connect after you set the host: var Message: string; Response: string; ... // port 80 normally used for http

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-04 Thread Bo Berglund
On Wed, 4 Apr 2018 17:09:49 +0200 (CEST), Michael Van Canneyt wrote: >I don't know what a 'good example' is for you, but the code in > >https://stackoverflow.com/questions/27257577/indy-mime-decoding-of-multipart-form-data-requests-returns-trailing-cr-lf > >Is quite

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-04 Thread Michael Van Canneyt
On Wed, 4 Apr 2018, Bo Berglund wrote: On Wed, 4 Apr 2018 15:29:36 +0200, Luca Olivetti wrote: By the way, I am using the Indy10 components via the indylaz package. Lazarus is 1.8.0 and FPC 3.0.4 on Windows7. I never used indy, but you can either use TFPHTTPClient (unit

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-04 Thread Bo Berglund
On Wed, 4 Apr 2018 15:29:36 +0200, Luca Olivetti wrote: >> By the way, I am using the Indy10 components via the indylaz package. >> Lazarus is 1.8.0 and FPC 3.0.4 on Windows7. > >I never used indy, but you can either use TFPHTTPClient (unit >fphttpclient) or synapse THHPSend.

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-04 Thread Luca Olivetti
El 04/04/18 a les 13:50, Bo Berglund ha escrit: Does someone have a suggestion on how to do this? By the way, I am using the Indy10 components via the indylaz package. Lazarus is 1.8.0 and FPC 3.0.4 on Windows7. I never used indy, but you can either use TFPHTTPClient (unit fphttpclient) or

[fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-04 Thread Bo Berglund
I have written a Lazarus/FPC program to configure an IoT device via a tcp server I have implemented on the device. It all works well for setting the parameters etc. Now I want to also add a firmware update function to this configurator program, but I could use some advice regarding the way to send