Recent

Author Topic: Cross-platform Method to Download File  (Read 25268 times)

a_butta

  • New Member
  • *
  • Posts: 12
Cross-platform Method to Download File
« on: September 07, 2010, 12:49:34 pm »
Hi,
I'm new on this forum, and i don't speack english very well, so i'm sorry for my language and i apologize to you if i mistook the location of the topic.

I would ask you if there's a cross-platform method to download a file through a Http URL using lazarus (not to depend on the OS i'm using).
Thank!

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927

a_butta

  • New Member
  • *
  • Posts: 12
Re: Cross-platform Method to Download File
« Reply #2 on: September 07, 2010, 02:36:39 pm »
Thank very much!
I installed LNet, but i didn't understand how to use it in according to my aim.
Can you help me?
Thank you!

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Cross-platform Method to Download File
« Reply #3 on: September 07, 2010, 02:49:34 pm »
I always use synapse, where you can simply use:
function HttpGetText(const URL: string; const Response: TStrings): Boolean;

For lNet there are examples in the zip file in lnet/examples/visual/http

a_butta

  • New Member
  • *
  • Posts: 12
Re: Cross-platform Method to Download File
« Reply #4 on: September 07, 2010, 03:56:31 pm »
Good!
I've only a doubt: do Synapse work either on Win and Linux?

Thanks!

Silvio Clécio

  • Guest
Re: Cross-platform Method to Download File
« Reply #5 on: September 07, 2010, 04:34:30 pm »
Hi,

A project using Synapse:

http://code.google.com/p/lazsolutions

E.g.:

http://code.google.com/p/lazsolutions/source/browse/#svn/trunk/Demos/LSHTTPSend

(Download, get picture, post in Twitter... etc).

Thanks. :)

Silvio Clécio

  • Guest
Re: Cross-platform Method to Download File
« Reply #6 on: September 07, 2010, 04:35:30 pm »
Oops, LazSolutions is cross-platform. ;)

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Cross-platform Method to Download File
« Reply #7 on: September 07, 2010, 06:44:25 pm »
I've only a doubt: do Synapse work either on Win and Linux?

Yes.

a_butta

  • New Member
  • *
  • Posts: 12
Re: Cross-platform Method to Download File
« Reply #8 on: September 07, 2010, 11:49:46 pm »
Good! Thank very very much to both.

I have another question and i don't know if i must open a new topic. If i must do, i apologize and do it.

How i can delete a file from a folder using a cross-platform method?

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Cross-platform Method to Download File
« Reply #10 on: September 08, 2010, 11:03:12 am »
Good work silvioprog. The more examples we can get on these things the better.
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

a_butta

  • New Member
  • *
  • Posts: 12
Re: Cross-platform Method to Download File
« Reply #11 on: September 08, 2010, 11:09:42 am »
Good! thank you!
About the preceding argoument, i downloaded the Synapse zip, but i didn't succeeding in installing the units in order to use them in all projects only adding a uses-clause, without having to put every time the units in projects directory.
I hope i had been clear.
Thank

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Cross-platform Method to Download File
« Reply #12 on: September 08, 2010, 11:42:43 am »
i downloaded the Synapse zip, but i didn't succeeding in installing the units in order to use them in all projects only adding a uses-clause, without having to put every time the units in projects directory.

There is a laz_synapse.lpk in trunk.
http://synalist.svn.sourceforge.net/viewvc/synalist/trunk.tar.gz?view=tar

a_butta

  • New Member
  • *
  • Posts: 12
Re: Cross-platform Method to Download File
« Reply #13 on: September 08, 2010, 12:23:41 pm »
i installed it, but i can't use httpsend in uses clauses. It return the classic error
"unit1.pas(8,80) Fatal: Can't find unit HttpSend used by Unit1"

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Cross-platform Method to Download File
« Reply #14 on: September 08, 2010, 12:37:23 pm »
i installed it, but i can't use httpsend in uses clauses. It return the classic error
"unit1.pas(8,80) Fatal: Can't find unit HttpSend used by Unit1"


Please read the Wiki and FAQ
http://wiki.lazarus.freepascal.org/Lazarus_Packages#FAQ

 

TinyPortal © 2005-2018