Page 1 of 1

Uploading/Downloading files on the Internet

Posted: 20 Sep 2007 2:25
by Chan Bok
I found an easy way to upload/download files on the internet, programmatically.

There is a ftp demo by Tonton Luc for uploading/downloading files.
However this program is rather complex and huge, and uses the old 5xVIP.

For downloading, there is a Windows API called "urlDownloadToFile" which
can do the job. This API needs urlmon.dll which is present in all Windows.
In your program, add the lines:

Code: Select all

resolve         urlDownloadToFile externally   % This needs urlmon.lib   class predicates   urlDownloadToFile: (unsigned,string URL,string File,unsigned32 Reserved,unsigned Callback) -> unsigned32 Hresult                 procedure language stdcall as "_URLDownloadToFileW@20".     clauses   dodownload(SourceURL,Destfile):-              Hresult = urlDownloadToFile(0,SourceURL,Destfile,0,0),              Hresult = 0,              (etc.)


For uploading, I use a DOS script and the built-in FTP program in Windows.
For example I create the following script.txt file:

Code: Select all

open ftphostname myname mypassword put filename bye
Then issue the DOS command:
ftp -s:script.txt

Any comments or suggestions are welcome.

Chan Bok
Axon Research

Posted: 8 Jan 2008 23:23
by Thomas Linder Puls
The urlDownloadToFile part has been copied to the wiki: URLDownloadToFile.

Posted: 12 Mar 2008 12:54
by Tonton Luc
Hi,
Where do I find urlmon.lib ?

Posted: 12 Mar 2008 14:00
by Thomas Linder Puls
It is part of Microsoft Windows Platform SDK (which can be downloaded for free, somewhere at Microsofts sites).